Skip to content

Commit

Permalink
Improve performance Notification Django Admin view
Browse files Browse the repository at this point in the history
  • Loading branch information
jaguarfi authored and markkuriekkinen committed Feb 8, 2021
1 parent 8c3b5b0 commit 9a197bd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions course/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def get_queryset(self, request):

class CourseInstanceAdmin(admin.ModelAdmin):

search_fields = ("instance_name", "course__name", "course__code")
list_display_links = ["instance_name"]
list_display = ["course", "instance_name", "visible_to_students",
"starting_time", "ending_time", instance_url]
Expand Down
6 changes: 4 additions & 2 deletions notification/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

from notification.models import Notification


class NotificationAdmin(admin.ModelAdmin):
pass
search_fields = ("subject", "notification", "sender__user__first_name",
"recipient__user__first_name", "course_instance__course__name")
autocomplete_fields = ("sender", "recipient", "course_instance")


admin.site.register(Notification, NotificationAdmin)
2 changes: 1 addition & 1 deletion userprofile/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@


class UserProfileAdmin(admin.ModelAdmin):
pass
search_fields = ("user__first_name", "user__last_name", "user__username", "student_id")


admin.site.register(UserProfile, UserProfileAdmin)

0 comments on commit 9a197bd

Please sign in to comment.