[PATCH v2 05/10] admin: Group register calls at bottom
Stephen Finucane
stephen at that.guru
Sun Oct 14 23:45:36 AEDT 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 f12b3387..0e9ccfa7 100644
--- a/patchwork/admin.py
+++ b/patchwork/admin.py
@@ -33,10 +33,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')
@@ -49,9 +45,6 @@ class ProjectAdmin(admin.ModelAdmin):
]
-admin.site.register(Project, ProjectAdmin)
-
-
class PersonAdmin(admin.ModelAdmin):
list_display = ('__str__', 'has_account')
search_fields = ('name', 'email')
@@ -64,16 +57,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', )
@@ -81,10 +68,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')
@@ -101,18 +84,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
@@ -135,16 +112,10 @@ class SeriesAdmin(admin.ModelAdmin):
return qs.prefetch_related('patches',)
-admin.site.register(Series, SeriesAdmin)
-
-
class SeriesReferenceAdmin(admin.ModelAdmin):
model = SeriesReference
-admin.site.register(SeriesReference, SeriesReferenceAdmin)
-
-
class CheckAdmin(admin.ModelAdmin):
list_display = ('patch', 'user', 'state', 'target_url',
'description', 'context')
@@ -153,20 +124,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.17.1
More information about the Patchwork
mailing list