[PATCH v3 2/8] trivial: Cleanup of 'admin.py'

Stephen Finucane stephen.finucane at intel.com
Fri Nov 6 04:13:17 AEDT 2015


Resolve some issues with the aforementioned file. These are mostly
stylistic changes.

In addition, add a missing license. The date and author are
calculated from Git logs.

Signed-off-by: Stephen Finucane <stephen.finucane at intel.com>
---
 patchwork/admin.py | 41 ++++++++++++++++++++++++++++++++++++-----
 1 file changed, 36 insertions(+), 5 deletions(-)

diff --git a/patchwork/admin.py b/patchwork/admin.py
index eb8daa1..04a8ff8 100644
--- a/patchwork/admin.py
+++ b/patchwork/admin.py
@@ -1,55 +1,86 @@
+# Patchwork - automated patch tracking system
+# Copyright (C) 2008 Jeremy Kerr <jk at ozlabs.org>
+#
+# This file is part of the Patchwork package.
+#
+# Patchwork is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# Patchwork is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Patchwork; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
 from django.contrib import admin
-from patchwork.models import Project, Person, UserProfile, State, Patch, \
-         Comment, Bundle, Tag
+
+from patchwork.models import (
+    Project, Person, UserProfile, State, Patch, Comment, Bundle, Tag)
+
 
 class ProjectAdmin(admin.ModelAdmin):
-    list_display = ('name', 'linkname','listid', 'listemail')
+    list_display = ('name', 'linkname', 'listid', 'listemail')
 admin.site.register(Project, ProjectAdmin)
 
+
 class PersonAdmin(admin.ModelAdmin):
     list_display = ('__unicode__', 'has_account')
     search_fields = ('name', 'email')
+
     def has_account(self, person):
         return bool(person.user)
+
     has_account.boolean = True
     has_account.admin_order_field = 'user'
     has_account.short_description = 'Account'
 admin.site.register(Person, PersonAdmin)
 
+
 class UserProfileAdmin(admin.ModelAdmin):
     search_fields = ('user__username', 'user__first_name', 'user__last_name')
 admin.site.register(UserProfile, UserProfileAdmin)
 
+
 class StateAdmin(admin.ModelAdmin):
     list_display = ('name', 'action_required')
 admin.site.register(State, StateAdmin)
 
+
 class PatchAdmin(admin.ModelAdmin):
     list_display = ('name', 'submitter', 'project', 'state', 'date',
-            'archived', 'is_pull_request')
+                    'archived', 'is_pull_request')
     list_filter = ('project', 'state', 'archived')
     search_fields = ('name', 'submitter__name', 'submitter__email')
     date_hierarchy = 'date'
+
     def is_pull_request(self, patch):
         return bool(patch.pull_url)
+
     is_pull_request.boolean = True
     is_pull_request.admin_order_field = 'pull_url'
     is_pull_request.short_description = 'Pull'
 admin.site.register(Patch, PatchAdmin)
 
+
 class CommentAdmin(admin.ModelAdmin):
     list_display = ('patch', 'submitter', 'date')
     search_fields = ('patch__name', 'submitter__name', 'submitter__email')
     date_hierarchy = 'date'
 admin.site.register(Comment, CommentAdmin)
 
+
 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.register(Tag, TagAdmin)
-
-- 
2.0.0



More information about the Patchwork mailing list