Skip to content

Commit

Permalink
no message
Browse files Browse the repository at this point in the history
  • Loading branch information
mosesmc52 committed Jan 17, 2022
1 parent e806373 commit deddd8d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
7 changes: 6 additions & 1 deletion news/admin.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.contrib import admin
from news import models
from admin_auto_filters.filters import AutocompleteFilter

# Register your models here.
def register_admin(model):
Expand All @@ -9,6 +10,10 @@ def wrapper(klass):
return klass
return wrapper

class LocationFilter(AutocompleteFilter):
title = 'Location' # display title
field_name = 'city' # name of the foreign key field

@admin.register(models.location)
class LocationAdmin(admin.ModelAdmin):
list_display = ('city','state','keywords')
Expand Down Expand Up @@ -60,7 +65,7 @@ class AlertAdmin(admin.ModelAdmin):
inlines = [
URLInline,
]

list_filter = [LocationFilter]
actions = [safe, notdrink, boil, notuse]

class ServedInline(admin.TabularInline):
Expand Down
8 changes: 4 additions & 4 deletions news/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@ def save(self, *args, **kwargs):
self.geocode = 'longitude=%s, latitude=%s, radius=5' % (geoc.latitude, geoc.longitude )
return super(location, self ).save(*args, **kwargs)

def __unicode__(self):
def __str__(self):
return '%s,%s' % (self.city, self.state)

class advisory_feed(models.Model):
source = models.CharField(max_length=255, null=True, blank=True,choices=SOURCE, default="")
feed = models.CharField(max_length=255, null=True, blank=True,default='')

def __unicode__(self):
def __str__(self):
return self.feed

class Meta:
Expand All @@ -50,7 +50,7 @@ class advisory_keyword(models.Model):
source = models.CharField(max_length=255, null=True, blank=True,choices=SOURCE, default="")
keyword = models.CharField(max_length=255, null=True, blank=True,default='')

def __unicode__(self):
def __str__(self):
return self.keyword

class Meta:
Expand All @@ -68,7 +68,7 @@ class alert(models.Model):
published = models.DateTimeField( null=True, blank = True )
created = models.DateTimeField( null=True, auto_now_add=True)

def __unicode__(self):
def __str__(self):
return self.sourceId

class url(models.Model):
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ certifi==2019.11.28
chardet==3.0.4
dj-database-url==0.5.0
Django==3.0.12
django-admin-autocomplete-filter==0.7.1
django-annoying==0.9.0
django-celery-beat==2.2.0
django-celery-results==2.2.0
Expand Down

0 comments on commit deddd8d

Please sign in to comment.