[PATCH 05/11] admin: Group register calls at bottom

Stephen Finucane stephen at that.guru
Mon Apr 16 08:53:59 AEST 2018


This seems more intuitive.

Signed-off-by: Stephen Finucane <stephen at that.guru>
---
 patchwork/admin.py | 48 +++++++++++++-----------------------------------
 1 file changed, 13 insertions(+), 35 deletions(-)

diff --git a/patchwork/admin.py b/patchwork/admin.py
index d43cc4dd..0c006fd9 100644
--- a/patchwork/admin.py
+++ b/patchwork/admin.py
@@ -49,10 +49,6 @@ class UserAdmin(BaseUserAdmin):
     inlines = (UserProfileInline, )
 
 
-admin.site.unregister(User)
-admin.site.register(User, UserAdmin)
-
-
 class DelegationRuleInline(admin.TabularInline):
     model = DelegationRule
     fields = ('path', 'user', 'priority')
@@ -65,9 +61,6 @@ class ProjectAdmin(admin.ModelAdmin):
     ]
 
 
-admin.site.register(Project, ProjectAdmin)
-
-
 class PersonAdmin(admin.ModelAdmin):
     list_display = ('__str__', 'has_account')
     search_fields = ('name', 'email')
@@ -80,16 +73,10 @@ class PersonAdmin(admin.ModelAdmin):
     has_account.short_description = 'Account'
 
 
-admin.site.register(Person, PersonAdmin)
-
-
 class StateAdmin(admin.ModelAdmin):
     list_display = ('name', 'action_required')
 
 
-admin.site.register(State, StateAdmin)
-
-
 class SubmissionAdmin(admin.ModelAdmin):
     list_display = ('name', 'submitter', 'project', 'date')
     list_filter = ('project', )
@@ -97,10 +84,6 @@ class SubmissionAdmin(admin.ModelAdmin):
     date_hierarchy = 'date'
 
 
-admin.site.register(Submission, SubmissionAdmin)
-admin.site.register(CoverLetter, SubmissionAdmin)
-
-
 class PatchAdmin(admin.ModelAdmin):
     list_display = ('name', 'submitter', 'project', 'state', 'date',
                     'archived', 'is_pull_request')
@@ -116,18 +99,12 @@ class PatchAdmin(admin.ModelAdmin):
     is_pull_request.short_description = 'Pull'
 
 
-admin.site.register(Patch, PatchAdmin)
-
-
 class CommentAdmin(admin.ModelAdmin):
     list_display = ('submission', 'submitter', 'date')
     search_fields = ('submission__name', 'submitter__name', 'submitter__email')
     date_hierarchy = 'date'
 
 
-admin.site.register(Comment, CommentAdmin)
-
-
 class PatchInline(admin.StackedInline):
     model = Series.patches.through
     extra = 0
@@ -146,9 +123,6 @@ class SeriesAdmin(admin.ModelAdmin):
     received_all.boolean = True
 
 
-admin.site.register(Series, SeriesAdmin)
-
-
 class SeriesInline(admin.StackedInline):
     model = Series
     readonly_fields = ('date', 'submitter', 'version', 'total',
@@ -166,9 +140,6 @@ class SeriesReferenceAdmin(admin.ModelAdmin):
     model = SeriesReference
 
 
-admin.site.register(SeriesReference, SeriesReferenceAdmin)
-
-
 class CheckAdmin(admin.ModelAdmin):
     list_display = ('patch', 'user', 'state', 'target_url',
                     'description', 'context')
@@ -177,20 +148,27 @@ class CheckAdmin(admin.ModelAdmin):
     date_hierarchy = 'date'
 
 
-admin.site.register(Check, CheckAdmin)
-
-
 class BundleAdmin(admin.ModelAdmin):
     list_display = ('name', 'owner', 'project', 'public')
     list_filter = ('public', 'project')
     search_fields = ('name', 'owner')
 
 
-admin.site.register(Bundle, BundleAdmin)
-
-
 class TagAdmin(admin.ModelAdmin):
     list_display = ('name',)
 
 
+admin.site.unregister(User)
+admin.site.register(User, UserAdmin)
+admin.site.register(Project, ProjectAdmin)
+admin.site.register(Person, PersonAdmin)
+admin.site.register(State, StateAdmin)
+admin.site.register(Submission, SubmissionAdmin)
+admin.site.register(CoverLetter, SubmissionAdmin)
+admin.site.register(Patch, PatchAdmin)
+admin.site.register(Comment, CommentAdmin)
+admin.site.register(Series, SeriesAdmin)
+admin.site.register(SeriesReference, SeriesReferenceAdmin)
+admin.site.register(Check, CheckAdmin)
+admin.site.register(Bundle, BundleAdmin)
 admin.site.register(Tag, TagAdmin)
-- 
2.14.3



More information about the Patchwork mailing list