Commit ac876f29 authored by Jeremy Kerr's avatar Jeremy Kerr
Browse files

Use new django admin infrastructure



Also, we don't need to expose every object.
Signed-off-by: default avatarJeremy Kerr <jk@ozlabs.org>
parent b380ba16
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)
......@@ -50,9 +50,6 @@ class Person(models.Model):
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)
......@@ -62,9 +59,6 @@ class Project(models.Model):
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)
......@@ -125,9 +119,6 @@ class UserProfile(models.Model):
person.user = self.user
person.save()
class Admin:
pass
def __str__(self):
return self.name()
......@@ -175,9 +166,6 @@ class RegistrationRequest(models.Model):
return user
class Admin:
pass
class UserPersonConfirmation(models.Model):
user = models.ForeignKey(User)
email = models.CharField(max_length = 200)
......@@ -200,11 +188,6 @@ class UserPersonConfirmation(models.Model):
person.save()
self.active = False
class Admin:
pass
class State(models.Model):
name = models.CharField(max_length = 100)
ordering = models.IntegerField(unique = True)
......@@ -216,9 +199,6 @@ class State(models.Model):
class Meta:
ordering = ['ordering']
class Admin:
pass
class HashField(models.Field):
__metaclass__ = models.SubfieldBase
......@@ -321,9 +301,6 @@ class Patch(models.Model):
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)
......@@ -332,9 +309,6 @@ class Comment(models.Model):
headers = models.TextField(blank = True)
content = models.TextField()
class Admin:
pass
class Meta:
ordering = ['date']
......@@ -351,9 +325,6 @@ class Bundle(models.Model):
class Meta:
unique_together = [('owner', 'name')]
class Admin:
pass
def public_url(self):
if not self.public:
return None
......
......@@ -18,13 +18,14 @@
# 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'}),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment