Skip to content

Commit

Permalink
Merge pull request #174 from CelineBoudier/add-filters-admin
Browse files Browse the repository at this point in the history
Adding filters for schools - search by region
  • Loading branch information
Andocas committed Apr 27, 2016
2 parents 205e486 + d1eec38 commit bc2aa5a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion portal/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ class ClassAdmin(admin.ModelAdmin):
list_filter = ['teacher']


class SchoolAdmin(admin.ModelAdmin):
search_fields = ['name', 'country', 'postcode', 'town']
list_filter = ['postcode', 'country']


class StudentAdmin(admin.ModelAdmin):
search_fields = ['user__user__first_name', 'user__user__last_name']
list_filter = ['class_field', 'class_field__teacher']
Expand All @@ -71,7 +76,7 @@ class UserProfileAdmin(admin.ModelAdmin):
admin.site.register(Student, StudentAdmin)
admin.site.register(Guardian)
admin.site.register(Teacher, TeacherAdmin)
admin.site.register(School)
admin.site.register(School, SchoolAdmin)
admin.site.unregister(User)
admin.site.register(User, UserAdmin)
admin.site.register(UserProfile, UserProfileAdmin)
Expand Down

0 comments on commit bc2aa5a

Please sign in to comment.