Skip to content
This repository has been archived by the owner on Jun 20, 2018. It is now read-only.

Django 1.8 support (WITH admin module) #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions nexus/nexus_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,11 @@ def password_change_done(self, request):

def make_admin_module(admin_site, name=None, app_name='admin'):
# XXX: might be a better API so we dont need to do this?
new_site = make_nexus_admin_site(admin_site)(name, app_name)
new_site_args = [name]
app_name = getattr(admin_site, 'app_name', None)
if app_name:
new_site_args.append(app_name)
new_site = make_nexus_admin_site(admin_site)(*new_site_args)
for model, admin in admin_site._registry.iteritems():
new_site.register(model, make_nexus_model_admin(admin))

Expand All @@ -141,7 +145,7 @@ class AdminModule(nexus.NexusModule):

def __init__(self, *args, **kwargs):
super(AdminModule, self).__init__(*args, **kwargs)
self.app_name = new_site.app_name
self.app_name = getattr(new_site, 'app_name', 'admin')
self.name = new_site.name
new_site.module = self
# new_site.name = self.site.name
Expand All @@ -164,4 +168,6 @@ def render_on_dashboard(self, request):
return AdminModule

if 'django.contrib.admin' in settings.INSTALLED_APPS:
nexus.site.register(make_admin_module(admin.site, admin.site.name, admin.site.app_name), admin.site.app_name)
app_name = getattr(admin.site, 'app_name', 'admin')

nexus.site.register(make_admin_module(admin.site, admin.site.name), app_name)