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

More django18 compat fixes #25

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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)
1 change: 0 additions & 1 deletion nexus/templates/nexus/admin/index.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{% extends "nexus/admin/base_site.html" %}

{% load i18n %}
{% load adminmedia %}

{% block breadcrumb_bits %}
<li><span>{% trans "Model Admin" %}</span></li>
Expand Down
8 changes: 4 additions & 4 deletions nexus/templates/nexus/admin/submit_line.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

<div class="submit-row" {% if is_popup %}style="overflow: auto;"{% endif %}>
{% if show_save %}
<button type="submit" name="_save" value="1" class="button default"{{ onclick_attrib }}>{% trans 'Save' %}</button>
<button type="submit" name="_save" value="1" class="button default">{% trans 'Save' %}</button>
{% endif %}
{% if show_delete_link %}
<p class="deletelink-box"><a href="delete/" class="button delete">{% trans "Delete" %}</a></p>
{% endif %}
{% if show_save_as_new %}
<button type="submit" value="1" name="_saveasnew" {{ onclick_attrib }}>{% trans 'Save as new' %}</button>
<button type="submit" value="1" name="_saveasnew">{% trans 'Save as new' %}</button>
{%endif%}
{% if show_save_and_add_another %}
<button type="submit" value="1" name="_addanother" class="button"{{ onclick_attrib }}>{% trans 'Save and add another' %}</button>
<button type="submit" value="1" name="_addanother" class="button">{% trans 'Save and add another' %}</button>
{% endif %}
{% if show_save_and_continue %}
<button type="submit" value="1" name="_continue" class="button"{{ onclick_attrib }}>{% trans 'Save and continue editing' %}</button>
<button type="submit" value="1" name="_continue" class="button">{% trans 'Save and continue editing' %}</button>
{% endif %}
</div>
2 changes: 0 additions & 2 deletions nexus/templatetags/nexus_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ def submit_row(context):
is_popup = context['is_popup']
save_as = context['save_as']
return {
'onclick_attrib': (opts.get_ordered_objects() and change
and 'onclick="submitOrderForm();"' or ''),
'show_delete_link': (not is_popup and context['has_delete_permission']
and (change or context['show_delete'])),
'show_save_as_new': not is_popup and change and save_as,
Expand Down