Verified Commit 826d850e authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Fix the push notificaitons admin search and change 'name' field

parent 5f5421ca
......@@ -7,22 +7,25 @@ from pushnotifications.models import Message
class DeviceAdmin(admin.ModelAdmin):
list_display = ('user', 'type', 'active', 'date_created')
list_display = ('name', 'type', 'active', 'date_created')
list_filter = ('active', 'type')
actions = ('enable', 'disable')
search_fields = ('name', 'device_id', 'user__username')
search_fields = ('registration_id', 'user__username',
'user__first_name', 'user__last_name')
def enable(self, request, queryset):
enable.short_description = _('Enable selected devices')
def disable(self, request, queryset):
disable.short_description = _('Disable selected devices')
def name(self, obj):
return '{} ({})'.format(obj.user.get_full_name(), obj.user.username)
name.short_description = _('Name')
class MessageAdmin(admin.ModelAdmin):
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment