mirror of
https://github.com/django/django.git
synced 2025-07-04 09:49:12 +00:00
newforms-admin: edit inline templates now match pre-newforms features and html/css updated
git-svn-id: http://code.djangoproject.com/svn/django/branches/newforms-admin@6122 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
8bc950bcf5
commit
1ca016a084
@ -58,3 +58,24 @@ fieldset.monospace textarea { font-family:"Bitstream Vera Sans Mono",Monaco,"Cou
|
||||
.vLargeTextField, .vXMLLargeTextField { width:48em; }
|
||||
.flatpages-flatpage #id_content { height:40.2em; }
|
||||
.module table .vPositiveSmallIntegerField { width:2.2em; }
|
||||
|
||||
/* x unsorted */
|
||||
.inline-group {padding:10px; padding-bottom:5px; background:#eee; margin:10px 0;}
|
||||
.inline-group h3.header {margin:-5px -10px 5px -10px; background:#bbb; color:#fff; padding:2px 5px 3px 5px; font-size:11px}
|
||||
.inline-related {margin-bottom:15px; position:relative;}
|
||||
.last-related {margin-bottom:0px;}
|
||||
.inline-related h2 { margin:0; padding:2px 5px 3px 5px; font-size:11px; text-align:left; font-weight:bold; color:#888; }
|
||||
.inline-related h2 b {font-weight:normal; color:#aaa;}
|
||||
.inline-related h2 span.delete {padding-left:20px; position:absolute; top:0px; right:5px;}
|
||||
.inline-related h2 span.delete label {margin-left:2px; padding-top:1px;}
|
||||
.inline-related fieldset {background:#fbfbfb;}
|
||||
.inline-related fieldset.module h2 { margin:0; padding:2px 5px 3px 5px; font-size:11px; text-align:left; font-weight:bold; background:#bcd; color:#fff; }
|
||||
.inline-related.tabular fieldset.module table {width:100%;}
|
||||
|
||||
.inline-group .tabular tr.has_original td {padding-top:2em;}
|
||||
.inline-group .tabular tr td.original { padding:2px 0 0 0; width:0; _position:relative; }
|
||||
.inline-group .tabular th.original {width:0px; padding:0;}
|
||||
.inline-group .tabular td.original p {position:absolute; left:0; height:1.1em; padding:2px 7px; overflow:hidden; font-size:9px; font-weight:bold; color:#666; _width:700px; }
|
||||
.inline-group ul.tools {padding:0; margin: 0; list-style:none;}
|
||||
.inline-group ul.tools li {display:inline; padding:0 5px;}
|
||||
.inline-group ul.tools a.add {background:url(../img/admin/icon_addlink.gif) 0 50% no-repeat; padding-left:14px;}
|
@ -729,10 +729,10 @@ class InlineModelAdmin(BaseModelAdmin):
|
||||
return [(None, {'fields': form.base_fields.keys()})]
|
||||
|
||||
class StackedInline(InlineModelAdmin):
|
||||
template = 'admin/edit_inline_stacked.html'
|
||||
template = 'admin/edit_inline/stacked.html'
|
||||
|
||||
class TabularInline(InlineModelAdmin):
|
||||
template = 'admin/edit_inline_tabular.html'
|
||||
template = 'admin/edit_inline/tabular.html'
|
||||
|
||||
class InlineAdminFormSet(object):
|
||||
"""
|
||||
|
@ -41,23 +41,7 @@
|
||||
{% endif %}
|
||||
|
||||
{% for fieldset in adminform %}
|
||||
<fieldset class="module aligned {{ fieldset.classes }}">
|
||||
{% if fieldset.name %}<h2>{{ fieldset.name }}</h2>{% endif %}
|
||||
{% if fieldset.description %}<div class="description">{{ fieldset.description }}</div>{% endif %}
|
||||
{% for line in fieldset %}
|
||||
<div class="form-row{% if line.errors %} errors{% endif %}">
|
||||
{{ line.errors }}
|
||||
{% for field in line %}
|
||||
{% if field.is_checkbox %}
|
||||
{{ field.field }}{{ field.label_tag }}
|
||||
{% else %}
|
||||
{{ field.label_tag }}{{ field.field }}
|
||||
{% endif %}
|
||||
{% if field.field.field.help_text %}<p class="help">{{ field.field.field.help_text }}</p>{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</fieldset>
|
||||
{% include "admin/includes/fieldset.html" %}
|
||||
{% endfor %}
|
||||
|
||||
{% block after_field_sets %}{% endblock %}
|
||||
|
@ -0,0 +1,25 @@
|
||||
{% load i18n %}
|
||||
<div class="inline-group">
|
||||
{{ inline_admin_formset.formset.management_form }}
|
||||
{# <h3 class="header">{{ inline_admin_formset.opts.verbose_name_plural|title }}</h3> #}
|
||||
|
||||
{% for inline_admin_form in inline_admin_formset %}
|
||||
<div class="inline-related {% if forloop.last %}last-related{% endif %}">
|
||||
<h2><b>{{ inline_admin_formset.opts.verbose_name|title }}:</b> {% if inline_admin_form.original %}{{ inline_admin_form.original }}{% else %} #{{ forloop.counter }}{% endif %}
|
||||
{% if inline_admin_formset.formset.deletable %}<span class="delete">{{ inline_admin_form.deletion_field.field }} {{ inline_admin_form.deletion_field.label_tag }}</span>{% endif %}
|
||||
</h2>
|
||||
{% if inline_admin_form.show_url %}
|
||||
<p><a href="/r/{{ inline_admin_form.original.content_type_id }}/{{ inline_admin_form.original.id }}/">View on site</a></p>
|
||||
{% endif %}
|
||||
|
||||
{% for fieldset in inline_admin_form %}
|
||||
{% include "admin/includes/fieldset.html" %}
|
||||
{% endfor %}
|
||||
{{ inline_admin_form.pk_field.field }}
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
{# <ul class="tools"> #}
|
||||
{# <li><a class="add" href="">Add another {{ inline_admin_formset.opts.verbose_name|title }}</a></li> #}
|
||||
{# </ul> #}
|
||||
</div>
|
@ -0,0 +1,63 @@
|
||||
{% load i18n %}
|
||||
<div class="inline-group">
|
||||
<div class="tabular inline-related {% if forloop.last %}last-related{% endif %}">
|
||||
{{ inline_admin_formset.formset.management_form }}
|
||||
<fieldset class="module">
|
||||
<h2>{{ inline_admin_formset.opts.verbose_name_plural|capfirst|escape }}</h2>
|
||||
<table>
|
||||
<thead><tr>
|
||||
{% for field in inline_admin_formset.fields %}
|
||||
{% if not field.is_hidden %}
|
||||
<th {% if forloop.first %}colspan="2"{% endif %}>{{ field.label|capfirst|escape }}</th>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if inline_admin_formset.formset.deletable %}<th>{% trans "Delete" %}?</th>{% endif %}
|
||||
</tr></thead>
|
||||
|
||||
{% for inline_admin_form in inline_admin_formset %}
|
||||
|
||||
<tr class="{% cycle row1,row2 %} {% if inline_admin_form.original or inline_admin_form.show_url %}has_original{% endif %}">
|
||||
|
||||
<td class="original">{% if inline_admin_form.original or inline_admin_form.show_url %}<p>
|
||||
{% if inline_admin_form.original %} {{ inline_admin_form.original }}{% endif %}
|
||||
{% if inline_admin_form.show_url %}<a href="/r/{{ inline_admin_form.original.content_type_id }}/{{ inline_admin_form.original.id }}/">View on site</a>{% endif %}
|
||||
</p>{% endif %}
|
||||
{{ inline_admin_form.pk_field.field }}
|
||||
{% spaceless %}
|
||||
{% for fieldset in inline_admin_form %}
|
||||
{% for line in fieldset %}
|
||||
{% for field in line %}
|
||||
{% if field.is_hidden %} {{ field.field }} {% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endspaceless %}
|
||||
</td>
|
||||
|
||||
{% for fieldset in inline_admin_form %}
|
||||
{% for line in fieldset %}
|
||||
{% for field in line %}
|
||||
<td class="{{ field.field.name }}">
|
||||
{{ field.field.errors.as_ul }}
|
||||
{{ field.field }}
|
||||
</td>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
||||
{% if inline_admin_formset.formset.deletable %}<td class="delete">{{ inline_admin_form.deletion_field.field }}</td>{% endif %}
|
||||
|
||||
</tr>
|
||||
|
||||
{% endfor %}
|
||||
|
||||
</table>
|
||||
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
{# <ul class="tools"> #}
|
||||
{# <li><a class="add" href="">Add another {{ inline_admin_formset.opts.verbose_name|title }}</a></li> #}
|
||||
{# </ul> #}
|
||||
|
||||
</div>
|
@ -1,49 +0,0 @@
|
||||
{{ inline_admin_formset.formset.management_form }}
|
||||
{% for inline_admin_form in inline_admin_formset %}
|
||||
<fieldset class="module aligned {{ bfset.fieldset.classes }}">
|
||||
<h2>{{ inline_admin_formset.opts.verbose_name|title }} #{{ forloop.counter }}</h2>
|
||||
{% for bfset in inline_admin_form %}
|
||||
<!-- fieldsets, headers, and descriptions are commented out until we have decent styles for them -->
|
||||
<!--<fieldset>-->
|
||||
<!--{% if bfset.fieldset.name %}<h2>{{ bfset.fieldset.name }}</h2>{% endif %}-->
|
||||
<!--{% if bfset.fieldset.description %}<div class="description">{{ bfset.fieldset.description }}</div>{% endif %}-->
|
||||
{% for line in bfset %}
|
||||
<div class="form-row{% if line.errors %} errors{% endif %}">
|
||||
{{ line.errors }}
|
||||
{% for field in line %}
|
||||
{% if field.is_checkbox %}
|
||||
{{ field.field }}{{ field.label_tag }}
|
||||
{% else %}
|
||||
{{ field.label_tag }}{{ field.field }}
|
||||
{% endif %}
|
||||
{% if field.field.field.help_text %}<p class="help">{{ field.field.field.help_text }}</p>{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
<!--</fieldset>-->
|
||||
{% endfor %}
|
||||
{{ inline_admin_form.pk_field.field }}
|
||||
{% if inline_admin_formset.formset.deletable %}<div class="form-row">{{ inline_admin_form.deletion_field.field }} {{ inline_admin_form.deletion_field.label_tag }}</div>{% endif %}
|
||||
</fieldset>
|
||||
{% endfor %}
|
||||
|
||||
{% comment %}
|
||||
<!-- Old forms. Here for reference until new forms match features -->
|
||||
|
||||
{% load admin_modify %}
|
||||
<fieldset class="module aligned">
|
||||
{% for fcw in bound_related_object.form_field_collection_wrappers %}
|
||||
<h2>{{ bound_related_object.relation.opts.verbose_name|capfirst|escape }} #{{ forloop.counter }}</h2>
|
||||
{% if bound_related_object.show_url %}{% if fcw.obj.original %}
|
||||
<p><a href="/r/{{ fcw.obj.original.content_type_id }}/{{ fcw.obj.original.id }}/">View on site</a></p>
|
||||
{% endif %}{% endif %}
|
||||
{% for bound_field in fcw.bound_fields %}
|
||||
{% if bound_field.hidden %}
|
||||
{% field_widget bound_field %}
|
||||
{% else %}
|
||||
{% admin_field_line bound_field %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</fieldset>
|
||||
{% endcomment %}
|
@ -1,94 +0,0 @@
|
||||
{% load i18n %}
|
||||
{{ inline_admin_formset.formset.management_form }}
|
||||
<fieldset class="module">
|
||||
<h2>{{ inline_admin_formset.opts.verbose_name_plural|capfirst|escape }}</h2>
|
||||
<table>
|
||||
<thead><tr>
|
||||
{% if inline_admin_formset.formset.deletable %}<th>{% trans "Delete" %}?</th>{% endif %}
|
||||
{% for field in inline_admin_formset.fields %}
|
||||
{% if not field.is_hidden %}
|
||||
<th>{{ field.label|capfirst|escape }}</th>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tr></thead>
|
||||
|
||||
{% for inline_admin_form in inline_admin_formset %}
|
||||
|
||||
<!-- still need optional original object -->
|
||||
|
||||
{% if inline_admin_form.form.errors %}
|
||||
<tr class="errorlist"><td colspan="{{ bound_inline.fields|length }}">
|
||||
{{ inline_admin_form.form.errors }}
|
||||
</td></tr>
|
||||
{% endif %}
|
||||
|
||||
<tr class="{% cycle row1,row2 %}">
|
||||
{{ inline_admin_form.pk_field.field }}
|
||||
{% if inline_admin_formset.formset.deletable %}<td>{{ inline_admin_form.deletion_field.field }}</td>{% endif %}
|
||||
{% for fieldset in inline_admin_form %}
|
||||
{% for line in fieldset %}
|
||||
{% for field in line %}
|
||||
<td>{{ field.field }}</td>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
||||
<!-- still need optional view on site link -->
|
||||
</tr>
|
||||
|
||||
{% endfor %}
|
||||
|
||||
</table>
|
||||
|
||||
<!-- still need for fcw in bound_related_object.form_field_collection_wrappers -->
|
||||
|
||||
</fieldset>
|
||||
|
||||
{% comment %}
|
||||
<!-- Old forms. Here for reference until new forms match features -->
|
||||
|
||||
{% load admin_modify %}
|
||||
<fieldset class="module">
|
||||
<h2>{{ bound_related_object.relation.opts.verbose_name_plural|capfirst|escape }}</h2><table>
|
||||
<thead><tr>
|
||||
{% for fw in bound_related_object.field_wrapper_list %}
|
||||
{% if fw.needs_header %}
|
||||
<th{{ fw.header_class_attribute }}>{{ fw.field.verbose_name|capfirst|escape }}</th>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tr></thead>
|
||||
{% for fcw in bound_related_object.form_field_collection_wrappers %}
|
||||
{% if change %}{% if original_row_needed %}
|
||||
{% if fcw.obj.original %}
|
||||
<tr class="row-label {% cycle row1,row2 %}"><td colspan="{{ num_headers }}"><strong>{{ fcw.obj.original }}</strong></tr>
|
||||
{% endif %}
|
||||
{% endif %}{% endif %}
|
||||
{% if fcw.obj.errors %}
|
||||
<tr class="errorlist"><td colspan="{{ num_headers }}">
|
||||
{{ fcw.obj.html_combined_error_list }}
|
||||
</tr>
|
||||
{% endif %}
|
||||
<tr class="{% cycle row1,row2 %}">
|
||||
{% for bound_field in fcw.bound_fields %}
|
||||
{% if not bound_field.hidden %}
|
||||
<td {{ bound_field.cell_class_attribute }}>
|
||||
{% field_widget bound_field %}
|
||||
</td>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% if bound_related_object.show_url %}<td>
|
||||
{% if fcw.obj.original %}<a href="/r/{{ fcw.obj.original.content_type_id }}/{{ fcw.obj.original.id }}/">View on site</a>{% endif %}
|
||||
</td>{% endif %}
|
||||
</tr>
|
||||
|
||||
{% endfor %} </table>
|
||||
|
||||
{% for fcw in bound_related_object.form_field_collection_wrappers %}
|
||||
{% for bound_field in fcw.bound_fields %}
|
||||
{% if bound_field.hidden %}
|
||||
{% field_widget bound_field %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</fieldset>
|
||||
{% endcomment %}
|
17
django/contrib/admin/templates/admin/includes/fieldset.html
Normal file
17
django/contrib/admin/templates/admin/includes/fieldset.html
Normal file
@ -0,0 +1,17 @@
|
||||
<fieldset class="module aligned {{ fieldset.classes }}">
|
||||
{% if fieldset.name %}<h2>{{ fieldset.name }}</h2>{% endif %}
|
||||
{% if fieldset.description %}<div class="description">{{ fieldset.description }}</div>{% endif %}
|
||||
{% for line in fieldset %}
|
||||
<div class="form-row{% if line.errors %} errors{% endif %} {% for field in line %}{{ field.field.name }} {% endfor %} ">
|
||||
{{ line.errors }}
|
||||
{% for field in line %}
|
||||
{% if field.is_checkbox %}
|
||||
{{ field.field }}{{ field.label_tag }}
|
||||
{% else %}
|
||||
{{ field.label_tag }}{{ field.field }}
|
||||
{% endif %}
|
||||
{% if field.field.field.help_text %}<p class="help">{{ field.field.field.help_text }}</p>{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</fieldset>
|
Loading…
x
Reference in New Issue
Block a user