Skip to content
This repository has been archived by the owner on Oct 1, 2020. It is now read-only.

Commit

Permalink
make the admin site a little more useful
Browse files Browse the repository at this point in the history
  • Loading branch information
monty5811 committed Oct 5, 2015
1 parent 367092d commit 82670ee
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 5 deletions.
61 changes: 56 additions & 5 deletions apostello/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,64 @@

from apostello import models

admin.site.register(models.RecipientGroup)
admin.site.register(models.Recipient)
admin.site.register(models.Keyword)
admin.site.register(models.SmsInbound)
admin.site.register(models.SmsOutbound)
admin.site.register(models.SiteConfiguration, SingletonModelAdmin)
admin.site.register(models.DefaultResponses, SingletonModelAdmin)

@admin.register(models.SmsOutbound)
class SmsOutboundAdmin(admin.ModelAdmin):
list_display = (
'content',
'recipient',
'time_sent',
'sent_by',
'sid',
)


@admin.register(models.SmsInbound)
class SmsInboundAdmin(admin.ModelAdmin):
list_display = (
'content',
'sender_name',
'matched_keyword',
'time_received',
'sid',
)


@admin.register(models.Keyword)
class KeywordAdmin(admin.ModelAdmin):
list_display = (
'keyword',
'is_live',
'activate_time',
'deactivate_time',
'description',
'custom_response',
'deactivated_response',
'too_early_response',
'is_archived',
)


@admin.register(models.Recipient)
class RecipientAdmin(admin.ModelAdmin):
list_display = (
'full_name',
'number',
'is_blocking',
'is_archived',
)


@admin.register(models.RecipientGroup)
class RecipientGroupAdmin(admin.ModelAdmin):
list_display = (
'name',
'description',
'is_archived',
)

admin.site.unregister(User)


Expand Down
1 change: 1 addition & 0 deletions apostello/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ def is_live(self):
else:
not_ended = timezone.now() < self.deactivate_time
return started and not_ended
is_live.boolean = True

def fetch_matches(self):
return SmsInbound.objects.filter(matched_keyword=self.keyword,
Expand Down
2 changes: 2 additions & 0 deletions apostello/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
SimpleView)

admin.autodiscover()

# index and two sending views, dashboard
urlpatterns = [
url(r'^$', SimpleView.as_view(template_name="apostello/index.html", required_perms=[]), name='index'),
Expand Down Expand Up @@ -107,6 +108,7 @@

# auth and admin
urlpatterns += [
url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
url(r'^admin/', include(admin.site.urls)),
url('', include('social.apps.django_app.urls', namespace='social')),
]
Expand Down
1 change: 1 addition & 0 deletions settings/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
INSTALLED_APPS = (
# built in apps
'django.contrib.admin',
'django.contrib.admindocs',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
Expand Down

0 comments on commit 82670ee

Please sign in to comment.