Skip to content

Commit

Permalink
admin: use decorator syntax
Browse files Browse the repository at this point in the history
This makes the code easier to read.
  • Loading branch information
nijel committed Oct 17, 2023
1 parent 4a68b94 commit a8713fa
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions social_django/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from .models import Association, Nonce, UserSocialAuth


@admin.register(UserSocialAuth)
class UserSocialAuthOption(admin.ModelAdmin):
"""Social Auth user options"""

Expand Down Expand Up @@ -48,21 +49,18 @@ def _get_all_field_names(model):
return list(set(names))


@admin.register(Nonce)
class NonceOption(admin.ModelAdmin):
"""Nonce options"""

list_display = ("id", "server_url", "timestamp", "salt")
search_fields = ("server_url",)


@admin.register(Association)
class AssociationOption(admin.ModelAdmin):
"""Association options"""

list_display = ("id", "server_url", "assoc_type")
list_filter = ("assoc_type",)
search_fields = ("server_url",)


admin.site.register(UserSocialAuth, UserSocialAuthOption)
admin.site.register(Nonce, NonceOption)
admin.site.register(Association, AssociationOption)

0 comments on commit a8713fa

Please sign in to comment.