Merge pull request #39 from BertrandBordage/master

Simplifies add_type_form.html. See #38.
fix_request_path_info
Diederik van der Boor 2013-07-05 02:24:21 -07:00
commit 53f6fd76ee
2 changed files with 7 additions and 37 deletions

View File

@ -336,6 +336,8 @@ class PolymorphicParentModelAdmin(admin.ModelAdmin):
'has_change_permission': self.has_change_permission(request),
'form_url': mark_safe(form_url),
'opts': opts,
'add': True,
'save_on_top': self.save_on_top,
})
if hasattr(self.admin_site, 'root_path'):
context['root_path'] = self.admin_site.root_path # Django < 1.4

View File

@ -1,43 +1,11 @@
{% extends "admin/change_form.html" %}
{% load i18n %}
{% load url from future %}
{% block breadcrumbs %}{% if not is_popup %}
<div class="breadcrumbs">
<a href="../../../">{% trans "Home" %}</a> &rsaquo;
<a href="../../">{{ app_label|capfirst|escape }}</a> &rsaquo;
{% if has_change_permission %}<a href="../">{{ opts.verbose_name_plural|capfirst }}</a>{% else %}{{ opts.verbose_name_plural|capfirst }}{% endif %} &rsaquo;
{% trans "Add" %} {{ opts.verbose_name }}
</div>
{% endif %}{% endblock %}
{% block content %}<div id="content-main">
<form action="{{ form_url }}" method="post" id="{{ opts.module_name }}_form">{% csrf_token %}{% block form_top %}{% endblock %}
<div>
{% if is_popup %}<input type="hidden" name="_popup" value="1" />{% endif %}
{% if save_on_top %}
<div class="submit-row" {% if is_popup %}style="overflow: auto;"{% endif %}>
<input type="submit" value="{% trans 'Submit' %}" class="default" name="_save" />
</div>
{% block submit_buttons_top %}
{% include 'admin/submit_line.html' with show_save=1 %}
{% endblock %}
{% endif %}
{% if errors %}
<p class="errornote">
{% blocktrans count errors|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
</p>
{{ adminform.form.non_field_errors }}
{% endif %}
{% for fieldset in adminform %}
{% include "admin/includes/fieldset.html" %}
{% endfor %}
<div class="submit-row" {% if is_popup %}style="overflow: auto;"{% endif %}>
<input type="submit" value="{% trans 'Submit' %}" class="default" name="_save" />
</div>
<script type="text/javascript">document.getElementById("{{ adminform.first_field.id_for_label }}").focus();</script>
</div>
</form></div>
{% block submit_buttons_bottom %}
{% include 'admin/submit_line.html' with show_save=1 %}
{% endblock %}