Commits

Anonymous committed 4404266

Fixed filter

Comments (0)

Files changed (1)

audittrail/admin.py

 
     def lookups(self, request, model_admin):
         return (
-            (user.pk, user.get_full_name())
+            (user.pk, user.get_full_name() or user.username)
             for user in User.objects.annotate(
                 last_audit=Max('audit_events__created')
             ).order_by('last_audit')[:20]
         )
 
     def queryset(self, request, queryset):
-        return queryset.filter(user__pk=self.value())
+        if self.value():
+            return queryset.filter(user__pk=self.value())
 
 class AuditAdmin(admin.ModelAdmin):
     list_display = ('created', 'user', 'action', 'details',)