diff options
-rw-r--r-- | main/admin.py | 38 | ||||
-rw-r--r-- | main/models.py | 32 | ||||
-rw-r--r-- | urls.py | 15 |
3 files changed, 45 insertions, 40 deletions
diff --git a/main/admin.py b/main/admin.py new file mode 100644 index 00000000..8c71d097 --- /dev/null +++ b/main/admin.py @@ -0,0 +1,38 @@ +from django.contrib import admin +from archweb_dev.main.models import (AltForum, Arch, Donor, Mirror, Package, Press, Repo) + +class AltForumAdmin(admin.ModelAdmin): + list_display = ('language', 'name') + list_filter = ('language',) + ordering = ['name'] + search_fields = ('name',) + +class DonorAdmin(admin.ModelAdmin): + ordering = ['name'] + search_fields = ('name',) + +class MirrorAdmin(admin.ModelAdmin): + list_display = ('domain', 'country') + list_filter = ('country',) + ordering = ['domain'] + search_fields = ('domain',) + +class PackageAdmin(admin.ModelAdmin): + list_display = ('pkgname', '_reponame', '_archname', '_maintainername') + list_filter = ('repo', 'arch', 'maintainer') + ordering = ['pkgname'] + search_fields = ('pkgname',) + +class PressAdmin(admin.ModelAdmin): + list_display = ('name', 'url') + ordering = ['name'] + search_fields = ('name',) + + +admin.site.register(AltForum, AltForumAdmin) +admin.site.register(Donor, DonorAdmin) +admin.site.register(Mirror, MirrorAdmin) +admin.site.register(Package, PackageAdmin) +admin.site.register(Press, PressAdmin) +admin.site.register(Arch) +admin.site.register(Repo) diff --git a/main/models.py b/main/models.py index a2753bc3..b1a68460 100644 --- a/main/models.py +++ b/main/models.py @@ -83,12 +83,6 @@ class Mirror(models.Model): return self.domain class Meta: db_table = 'mirrors' - class Admin: - list_display = ('domain', 'country') - list_filter = ('country',) - ordering = ['domain'] - search_fields = ('domain') - pass class Press(models.Model): id = models.AutoField(primary_key=True) @@ -99,11 +93,6 @@ class Press(models.Model): class Meta: db_table = 'press' verbose_name_plural = 'press' - class Admin: - list_display = ('name', 'url') - ordering = ['name'] - search_fields = ('name') - pass class AltForum(models.Model): id = models.AutoField(primary_key=True) @@ -115,12 +104,6 @@ class AltForum(models.Model): class Meta: db_table = 'alt_forums' verbose_name = 'AltForum' - class Admin: - list_display = ('language', 'name') - list_filter = ('language',) - ordering = ['name'] - search_fields = ('name') - pass class Donor(models.Model): id = models.AutoField(primary_key=True) @@ -129,10 +112,6 @@ class Donor(models.Model): return self.name class Meta: db_table = 'donors' - class Admin: - ordering = ['name'] - search_fields = ('name') - pass class News(models.Model): id = models.AutoField(primary_key=True) @@ -161,8 +140,6 @@ class Arch(models.Model): db_table = 'arches' ordering = ['name'] verbose_name_plural = 'arches' - class Admin: - pass class Repo(models.Model): id = models.AutoField(primary_key=True) @@ -173,8 +150,6 @@ class Repo(models.Model): db_table = 'repos' ordering = ['name'] verbose_name_plural = 'repos' - class Admin: - pass class Package(models.Model): id = models.AutoField(primary_key=True) @@ -194,13 +169,6 @@ class Package(models.Model): #get_latest_by = 'last_update' #ordering = ('-last_update',) - class Admin: - list_display = ('pkgname', '_reponame', '_archname', '_maintainername') - list_filter = ('repo', 'arch', 'maintainer') - ordering = ['pkgname'] - search_fields = ('pkgname',) - pass - def __str__(self): return self.pkgname @@ -1,9 +1,13 @@ from django.conf.urls.defaults import * from django.conf import settings -from django.views.decorators.cache import cache_page +from django.contrib import admin + from django.views.generic.create_update import delete_object from django.contrib.auth.decorators import permission_required -from archweb_dev.main.models import News, Todolist + +from archweb_dev.main.models import Todolist + +admin.autodiscover() urlpatterns = patterns('', # Dynamic Stuff @@ -53,16 +57,11 @@ urlpatterns = patterns('', # (mostly) Static Pages (r'^$', 'archweb_dev.devel.views.siteindex'), - (r'^about/$', 'archweb_dev.devel.views.about'), - (r'^art/$', 'archweb_dev.devel.views.art'), (r'^cvs/$', 'archweb_dev.devel.views.cvs'), (r'^developers/$', 'archweb_dev.devel.views.developers'), (r'^fellows/$', 'archweb_dev.devel.views.fellows'), (r'^donate/$', 'archweb_dev.devel.views.donate'), (r'^download/$', 'archweb_dev.devel.views.download'), - (r'^irc/$', 'archweb_dev.devel.views.irc'), - (r'^moreforums/$', 'archweb_dev.devel.views.moreforums'), - (r'^press/$', 'archweb_dev.devel.views.press'), (r'^projects/$', 'archweb_dev.devel.views.projects'), (r'^robots.txt$', 'archweb_dev.devel.views.robots'), @@ -72,7 +71,7 @@ urlpatterns = patterns('', (r'^accounts/login/$', 'django.contrib.auth.views.login', {'template_name': 'registration/login.html'}), (r'^logout/$', 'django.contrib.auth.views.logout', {'template_name': 'registration/logout.html'}), (r'^accounts/logout/$', 'django.contrib.auth.views.logout', {'template_name': 'registration/logout.html'}), - (r'^admin/', include('django.contrib.admin.urls')), + (r'^admin/(.*)', admin.site.root), ) if settings.DEBUG == True: |