Permalink
Browse files

Merge branch 'dev' of https://github.com/mvdwaeter/django-fiber into …

…mvdwaeter-dev
  • Loading branch information...
2 parents 8521d58 + 781f703 commit 90c0d330e1dce58e9c65bf9f46c8e5a507496868 @dbunskoek dbunskoek committed Jan 10, 2012
Showing with 29 additions and 11 deletions.
  1. +5 −9 fiber/admin.py
  2. +2 −2 fiber/admin_urls.py
  3. +13 −0 fiber/fiber_admin/__init__.py
  4. +9 −0 fiber/fiber_admin/options.py
View
@@ -9,11 +9,7 @@
from models import Page, ContentItem, PageContentItem, Image, File
import admin_forms as forms
-
-class FiberAdminSite(admin.AdminSite):
- pass
-
-fiber_admin_site = FiberAdminSite(name='fiber_admin')
+import fiber_admin
class FileAdmin(admin.ModelAdmin):
@@ -94,15 +90,15 @@ def action_links(self, page):
action_links.allow_tags = True
-class FiberAdminContentItemAdmin(admin.ModelAdmin):
+class FiberAdminContentItemAdmin(fiber_admin.ModelAdmin):
list_display = ('__unicode__',)
form = forms.ContentItemAdminForm
fieldsets = (
(None, {'classes': ('hide-label',), 'fields': (get_editor_field_name('content_html'),)}),
)
-class FiberAdminPageAdmin(MPTTModelAdmin):
+class FiberAdminPageAdmin(fiber_admin.MPTTModelAdmin):
form = forms.FiberAdminPageForm
@@ -137,5 +133,5 @@ def save_model(self, request, obj, form, change):
admin.site.register(File, FileAdmin)
admin.site.register(Page, PageAdmin)
-fiber_admin_site.register(ContentItem, FiberAdminContentItemAdmin)
-fiber_admin_site.register(Page, FiberAdminPageAdmin)
+fiber_admin.site.register(ContentItem, FiberAdminContentItemAdmin)
+fiber_admin.site.register(Page, FiberAdminPageAdmin)
View
@@ -1,12 +1,12 @@
from django.conf.urls.defaults import *
-from admin import fiber_admin_site
+import fiber_admin
import admin_views
urlpatterns = patterns('',
url(r'^page/(?P<id>\d+)/move_up/$', admin_views.page_move_up, name='fiber_page_move_up'),
url(r'^page/(?P<id>\d+)/move_down/$', admin_views.page_move_down, name='fiber_page_move_down'),
url(r'^login/$', admin_views.fiber_login, name='fiber_login'),
- (r'^fiber_admin/', include(fiber_admin_site.urls)),
+ (r'^fiber_admin/', include(fiber_admin.site.urls)),
)
@@ -0,0 +1,13 @@
+from django.contrib import admin
+from options import ModelAdmin, MPTTModelAdmin
+
+
+class FiberAdminSite(admin.AdminSite):
+
+ def register(self, model_or_iterable, admin_class=None, **options):
+ if not admin_class:
+ admin_class = ModelAdmin
+ return super(FiberAdminSite, self).register(model_or_iterable, admin_class=admin_class, **options)
+
+
+site = FiberAdminSite(name='fiber_admin')
@@ -0,0 +1,9 @@
+from django.contrib.admin import ModelAdmin as DjangoModelAdmin
+from mptt.admin import MPTTModelAdmin as DjangoMPTTModelAdmin
+
+
+class ModelAdmin(DjangoModelAdmin):
+ pass
+
+class MPTTModelAdmin(DjangoMPTTModelAdmin):
+ pass

0 comments on commit 90c0d33

Please sign in to comment.