Simplifies add_type_form.html. See #38.
parent
f17493ebb9
commit
40eeb15fad
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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> ›
|
||||
<a href="../../">{{ app_label|capfirst|escape }}</a> ›
|
||||
{% if has_change_permission %}<a href="../">{{ opts.verbose_name_plural|capfirst }}</a>{% else %}{{ opts.verbose_name_plural|capfirst }}{% endif %} ›
|
||||
{% 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>
|
||||
{% 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_top %}
|
||||
{% include 'admin/submit_line.html' with show_save=1 %}
|
||||
{% endblock %}
|
||||
{% endif %}
|
||||
|
||||
{% block submit_buttons_bottom %}
|
||||
{% include 'admin/submit_line.html' with show_save=1 %}
|
||||
{% endblock %}
|
||||
|
|
|
|||
Loading…
Reference in New Issue