Skip to content
Browse files

docstrings

  • Loading branch information...
1 parent 164212b commit 5933180e8a16ab28e7d0771a0c5f155d733fe339 Shaun Sephton committed
Showing with 4 additions and 0 deletions.
  1. +4 −0 preferences/admin.py
View
4 preferences/admin.py
@@ -7,8 +7,12 @@
csrf_protect_m = method_decorator(csrf_protect)
class PreferencesAdmin(admin.ModelAdmin):
+
@csrf_protect_m
def changelist_view(self, request, extra_context=None):
+ """
+ If we only have a single preference object redirect to it, otherwise display listing.
+ """
model = self.model
if model.objects.all().count() > 1:
return super(PreferencesAdmin, self).changelist_view(request)

0 comments on commit 5933180

Please sign in to comment.
Something went wrong with that request. Please try again.