Commits

Victor Gavro committed 10708d9

Improved admin interface

Comments (0)

Files changed (2)

 
 def sms_start_text(obj):
   return unicode(obj)
+sms_start_text.short_description = _('SMS text')
 def sms_recipients_count(obj):
   return obj.recipients.all().count()
+sms_recipients_count.short_description = _('Total recipients')
 def sms_success_count(obj):
   return obj.recipients.filter(status__in = settings.SUCCESS_STATUSES).count()
+sms_success_count.short_description = _('Successed recipients')
 
 class SmsRecipientInline(admin.TabularInline):
   model = SmsRecipient
-  extra = 10
 
 class SmsAdmin(admin.ModelAdmin):
   list_display = (sms_start_text,'sender',sms_recipients_count,sms_success_count)
   inlines = (
     SmsRecipientInline,
   )
+  ordering = ('-id',)
 
 class SmsRecipientAdmin(admin.ModelAdmin):
   actions = [sms_recipient_get_status,sms_recipient_resend]
-  list_display = ('phone','sms','status','status_text','status_time','sent_time')
+  list_display = ('phone','sms','status','status_text','status_time','sent_time','queued_time')
+  list_filter = ('status',)
+  ordering = ('-queued_time','-sent_time','-status_time')
 
 admin.site.register(Sms,SmsAdmin)
 admin.site.register(SmsRecipient,SmsRecipientAdmin)

smsgate_test/manage.py

File contents unchanged.