Commits

Anonymous committed ee7847c

Use new django admin infrastructure

Also, we don't need to expose every object.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

Comments (0)

Files changed (3)

apps/patchwork/admin.py

+from django.contrib import admin
+from patchwork.models import Project, Person, UserProfile, State, Patch, \
+	     Comment, Bundle
+
+admin_site = admin.AdminSite()
+
+class ProjectAdmin(admin.ModelAdmin):
+    pass
+admin_site.register(Project, ProjectAdmin)
+
+class PersonAdmin(admin.ModelAdmin):
+    pass
+admin_site.register(Person, PersonAdmin)
+
+class UserProfileAdmin(admin.ModelAdmin):
+    pass
+admin_site.register(UserProfile, UserProfileAdmin)
+
+class StateAdmin(admin.ModelAdmin):
+    pass
+admin_site.register(State, StateAdmin)
+
+class PatchAdmin(admin.ModelAdmin):
+    pass
+admin_site.register(Patch, PatchAdmin)
+
+class CommentAdmin(admin.ModelAdmin):
+    pass
+admin_site.register(Comment, CommentAdmin)
+
+class BundleAdmin(admin.ModelAdmin):
+    pass
+admin_site.register(Bundle, BundleAdmin)

apps/patchwork/models.py

     class Meta:
         verbose_name_plural = 'People'
 
-    class Admin:
-        pass
-
 class Project(models.Model):
     linkname = models.CharField(max_length=255, unique=True)
     name = models.CharField(max_length=255, unique=True)
     def __str__(self):
         return self.name
 
-    class Admin:
-        pass
-
 class UserProfile(models.Model):
     user = models.ForeignKey(User, unique = True)
     primary_project = models.ForeignKey(Project, null = True)
 		 person.user = self.user
 		 person.save()
 
-    class Admin:
-        pass
-
     def __str__(self):
         return self.name()
 
 
         return user
 
-    class Admin:
-        pass
-
 class UserPersonConfirmation(models.Model):
     user = models.ForeignKey(User)
     email = models.CharField(max_length = 200)
         person.save()
         self.active = False
 
-
-    class Admin:
-        pass
-
-
 class State(models.Model):
     name = models.CharField(max_length = 100)
     ordering = models.IntegerField(unique = True)
     class Meta:
         ordering = ['ordering']
 
-    class Admin:
-        pass
-
 class HashField(models.Field):
     __metaclass__ = models.SubfieldBase
 
         verbose_name_plural = 'Patches'
         ordering = ['date']
 
-    class Admin:
-        pass
-
 class Comment(models.Model):
     patch = models.ForeignKey(Patch)
     msgid = models.CharField(max_length=255, unique = True)
     headers = models.TextField(blank = True)
     content = models.TextField()
 
-    class Admin:
-        pass
-
     class Meta:
         ordering = ['date']
 
     class Meta:
         unique_together = [('owner', 'name')]
 
-    class Admin:
-        pass
-
     def public_url(self):
         if not self.public:
             return None
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
 from django.conf.urls.defaults import *
+from patchwork.admin import admin_site
 
 urlpatterns = patterns('',
     # Example:
     (r'^', include('patchwork.urls')),
 
     # Uncomment this for admin:
-     (r'^admin/', include('django.contrib.admin.urls')),
+     (r'^admin/(.*)', admin_site.root),
 
      (r'^css/(?P<path>.*)$', 'django.views.static.serve',
 	{'document_root': '/home/jk/devel/patchwork/pwsite/htdocs/css'}),