Django

Code

Changeset 6122

Show
Ignore:
Timestamp:
09/13/07 03:36:04 (1 year ago)
Author:
xian
Message:

newforms-admin: edit inline templates now match pre-newforms features and html/css updated

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/branches/newforms-admin/django/contrib/admin/media/css/forms.css

    r5195 r6122  
    5959.flatpages-flatpage #id_content { height:40.2em; } 
    6060.module table .vPositiveSmallIntegerField { width:2.2em; } 
     61 
     62/* x unsorted */ 
     63.inline-group {padding:10px; padding-bottom:5px; background:#eee; margin:10px 0;} 
     64.inline-group h3.header {margin:-5px -10px 5px -10px; background:#bbb; color:#fff; padding:2px 5px 3px 5px; font-size:11px} 
     65.inline-related {margin-bottom:15px; position:relative;} 
     66.last-related {margin-bottom:0px;} 
     67.inline-related h2 { margin:0; padding:2px 5px 3px 5px; font-size:11px; text-align:left; font-weight:bold;  color:#888; } 
     68.inline-related h2 b {font-weight:normal; color:#aaa;} 
     69.inline-related h2 span.delete {padding-left:20px; position:absolute; top:0px; right:5px;} 
     70.inline-related h2 span.delete label {margin-left:2px; padding-top:1px;} 
     71.inline-related fieldset {background:#fbfbfb;} 
     72.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; } 
     73.inline-related.tabular fieldset.module table {width:100%;} 
     74 
     75.inline-group .tabular tr.has_original td {padding-top:2em;} 
     76.inline-group .tabular tr td.original { padding:2px 0 0 0; width:0; _position:relative; } 
     77.inline-group .tabular th.original {width:0px; padding:0;} 
     78.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;     } 
     79.inline-group ul.tools {padding:0; margin: 0; list-style:none;} 
     80.inline-group ul.tools li {display:inline; padding:0 5px;} 
     81.inline-group ul.tools a.add {background:url(../img/admin/icon_addlink.gif) 0 50% no-repeat; padding-left:14px;} 
  • django/branches/newforms-admin/django/contrib/admin/options.py

    r6107 r6122  
    730730 
    731731class StackedInline(InlineModelAdmin): 
    732     template = 'admin/edit_inline_stacked.html' 
     732    template = 'admin/edit_inline/stacked.html' 
    733733 
    734734class TabularInline(InlineModelAdmin): 
    735     template = 'admin/edit_inline_tabular.html' 
     735    template = 'admin/edit_inline/tabular.html' 
    736736 
    737737class InlineAdminFormSet(object): 
  • django/branches/newforms-admin/django/contrib/admin/templates/admin/change_form.html

    r6080 r6122  
    4242 
    4343{% for fieldset in adminform %} 
    44     <fieldset class="module aligned {{ fieldset.classes }}"> 
    45     {% if fieldset.name %}<h2>{{ fieldset.name }}</h2>{% endif %} 
    46     {% if fieldset.description %}<div class="description">{{ fieldset.description }}</div>{% endif %} 
    47     {% for line in fieldset %} 
    48         <div class="form-row{% if line.errors %} errors{% endif %}"> 
    49         {{ line.errors }} 
    50         {% for field in line %} 
    51             {% if field.is_checkbox %} 
    52                 {{ field.field }}{{ field.label_tag }} 
    53             {% else %} 
    54                 {{ field.label_tag }}{{ field.field }} 
    55             {% endif %} 
    56             {% if field.field.field.help_text %}<p class="help">{{ field.field.field.help_text }}</p>{% endif %} 
    57         {% endfor %} 
    58         </div> 
    59     {% endfor %} 
    60     </fieldset> 
     44  {% include "admin/includes/fieldset.html" %} 
    6145{% endfor %} 
    6246 
  • django/branches/newforms-admin/django/contrib/admin/templates/admin/edit_inline/stacked.html

    r6107 r6122  
     1{% load i18n %} 
     2<div class="inline-group"> 
    13{{ inline_admin_formset.formset.management_form }} 
     4{# <h3 class="header">{{ inline_admin_formset.opts.verbose_name_plural|title }}</h3> #} 
     5 
    26{% for inline_admin_form in inline_admin_formset %} 
    3 <fieldset class="module aligned {{ bfset.fieldset.classes }}"> 
    4   <h2>{{ inline_admin_formset.opts.verbose_name|title }}&nbsp;#{{ forloop.counter }}</h2> 
    5   {% for bfset in inline_admin_form %} 
    6     <!-- fieldsets, headers, and descriptions are commented out until we have decent styles for them --> 
    7     <!--<fieldset>--> 
    8       <!--{% if bfset.fieldset.name %}<h2>{{ bfset.fieldset.name }}</h2>{% endif %}--> 
    9       <!--{% if bfset.fieldset.description %}<div class="description">{{ bfset.fieldset.description }}</div>{% endif %}--> 
    10       {% for line in bfset %} 
    11           <div class="form-row{% if line.errors %} errors{% endif %}"> 
    12           {{ line.errors }} 
    13           {% for field in line %} 
    14               {% if field.is_checkbox %} 
    15                   {{ field.field }}{{ field.label_tag }} 
    16               {% else %} 
    17                   {{ field.label_tag }}{{ field.field }} 
    18               {% endif %} 
    19               {% if field.field.field.help_text %}<p class="help">{{ field.field.field.help_text }}</p>{% endif %} 
    20           {% endfor %} 
    21           </div> 
    22       {% endfor %} 
    23     <!--</fieldset>--> 
     7<div class="inline-related {% if forloop.last %}last-related{% endif %}"> 
     8  <h2><b>{{ inline_admin_formset.opts.verbose_name|title }}:</b>&nbsp;{% if inline_admin_form.original %}{{ inline_admin_form.original }}{% else %} #{{ forloop.counter }}{% endif %} 
     9    {% if inline_admin_formset.formset.deletable %}<span class="delete">{{ inline_admin_form.deletion_field.field }} {{ inline_admin_form.deletion_field.label_tag }}</span>{% endif %} 
     10    </h2> 
     11  {% if inline_admin_form.show_url %} 
     12  <p><a href="/r/{{ inline_admin_form.original.content_type_id }}/{{ inline_admin_form.original.id }}/">View on site</a></p> 
     13  {% endif %} 
     14 
     15  {% for fieldset in inline_admin_form %} 
     16    {% include "admin/includes/fieldset.html" %} 
    2417  {% endfor %} 
    2518  {{ inline_admin_form.pk_field.field }} 
    26   {% 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 %} 
    27 </fieldset> 
     19</div> 
    2820{% endfor %} 
    2921 
    30 {% comment %} 
    31 <!-- Old forms. Here for reference until new forms match features --> 
    32  
    33 {% load admin_modify %} 
    34 <fieldset class="module aligned"> 
    35    {% for fcw in bound_related_object.form_field_collection_wrappers %} 
    36       <h2>{{ bound_related_object.relation.opts.verbose_name|capfirst|escape }}&nbsp;#{{ forloop.counter }}</h2> 
    37       {% if bound_related_object.show_url %}{% if fcw.obj.original %} 
    38       <p><a href="/r/{{ fcw.obj.original.content_type_id }}/{{ fcw.obj.original.id }}/">View on site</a></p> 
    39       {% endif %}{% endif %} 
    40       {% for bound_field in fcw.bound_fields %} 
    41          {% if bound_field.hidden %} 
    42             {% field_widget bound_field %} 
    43          {% else %} 
    44             {% admin_field_line bound_field %} 
    45          {% endif %} 
    46       {% endfor %} 
    47     {% endfor %} 
    48 </fieldset> 
    49 {% endcomment %} 
     22{# <ul class="tools"> #} 
     23{#   <li><a class="add" href="">Add another {{ inline_admin_formset.opts.verbose_name|title }}</a></li> #} 
     24{# </ul> #} 
     25</div> 
  • django/branches/newforms-admin/django/contrib/admin/templates/admin/edit_inline/tabular.html

    r6107 r6122  
    11{% load i18n %} 
     2<div class="inline-group"> 
     3  <div class="tabular inline-related {% if forloop.last %}last-related{% endif %}"> 
    24{{ inline_admin_formset.formset.management_form }} 
    35<fieldset class="module"> 
     
    57   <table> 
    68     <thead><tr> 
    7      {% if inline_admin_formset.formset.deletable %}<th>{% trans "Delete" %}?</th>{% endif %} 
    89     {% for field in inline_admin_formset.fields %} 
    910       {% if not field.is_hidden %} 
    10          <th>{{ field.label|capfirst|escape }}</th> 
     11         <th {% if forloop.first %}colspan="2"{% endif %}>{{ field.label|capfirst|escape }}</th> 
    1112        {% endif %} 
    1213     {% endfor %} 
     14     {% if inline_admin_formset.formset.deletable %}<th>{% trans "Delete" %}?</th>{% endif %} 
    1315     </tr></thead> 
    1416    
    1517     {% for inline_admin_form in inline_admin_formset %} 
    16     
    17         <!-- still need optional original object --> 
    18          
    19         {% if inline_admin_form.form.errors %} 
    20            <tr class="errorlist"><td colspan="{{ bound_inline.fields|length }}"> 
    21               {{ inline_admin_form.form.errors }} 
    22            </td></tr> 
    23         {% endif %} 
    24          
    25         <tr class="{% cycle row1,row2 %}"> 
    26         {{ inline_admin_form.pk_field.field }} 
    27         {% if inline_admin_formset.formset.deletable %}<td>{{ inline_admin_form.deletion_field.field }}</td>{% endif %} 
     18                    
     19        <tr class="{% cycle row1,row2 %} {% if inline_admin_form.original or inline_admin_form.show_url %}has_original{% endif %}"> 
     20 
     21        <td class="original">{% if inline_admin_form.original or inline_admin_form.show_url %}<p> 
     22          {% if inline_admin_form.original %} {{ inline_admin_form.original }}{% endif %} 
     23          {% 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 %} 
     24            </p>{% endif %} 
     25          {{ inline_admin_form.pk_field.field }} 
     26          {% spaceless %} 
     27          {% for fieldset in inline_admin_form %} 
     28            {% for line in fieldset %} 
     29              {% for field in line %} 
     30                {% if field.is_hidden %} {{ field.field }} {% endif %} 
     31              {% endfor %} 
     32            {% endfor %} 
     33          {% endfor %} 
     34          {% endspaceless %} 
     35        </td> 
     36 
    2837        {% for fieldset in inline_admin_form %} 
    2938          {% for line in fieldset %} 
    3039            {% for field in line %} 
    31               <td>{{ field.field }}</td> 
     40              <td class="{{ field.field.name }}"> 
     41              {{ field.field.errors.as_ul }} 
     42              {{ field.field }} 
     43              </td> 
    3244            {% endfor %} 
    3345          {% endfor %} 
    3446        {% endfor %} 
     47                 
     48        {% if inline_admin_formset.formset.deletable %}<td class="delete">{{ inline_admin_form.deletion_field.field }}</td>{% endif %} 
    3549         
    36         <!-- still need optional view on site link --> 
    3750        </tr> 
    3851 
     
    4053    
    4154   </table> 
    42  
    43    <!-- still need  for fcw in bound_related_object.form_field_collection_wrappers --> 
    4455    
    4556</fieldset> 
    46  
    47 {% comment %} 
    48 <!-- Old forms. Here for reference until new forms match features --> 
    49  
    50 {% load admin_modify %} 
    51 <fieldset class="module"> 
    52    <h2>{{ bound_related_object.relation.opts.verbose_name_plural|capfirst|escape }}</h2><table> 
    53    <thead><tr> 
    54    {% for fw in bound_related_object.field_wrapper_list %} 
    55       {% if fw.needs_header %} 
    56          <th{{ fw.header_class_attribute }}>{{ fw.field.verbose_name|capfirst|escape }}</th> 
    57       {% endif %} 
    58    {% endfor %} 
    59    </tr></thead> 
    60    {% for fcw in bound_related_object.form_field_collection_wrappers %} 
    61       {% if change %}{% if original_row_needed %} 
    62          {% if fcw.obj.original %} 
    63             <tr class="row-label {% cycle row1,row2 %}"><td colspan="{{ num_headers }}"><strong>{{ fcw.obj.original }}</strong></tr> 
    64          {% endif %} 
    65       {% endif %}{% endif %} 
    66       {% if fcw.obj.errors %} 
    67          <tr class="errorlist"><td colspan="{{ num_headers }}"> 
    68             {{ fcw.obj.html_combined_error_list }} 
    69          </tr> 
    70       {% endif %} 
    71       <tr class="{% cycle row1,row2 %}"> 
    72       {% for bound_field in fcw.bound_fields %} 
    73          {% if not bound_field.hidden %} 
    74          <td {{ bound_field.cell_class_attribute }}> 
    75             {% field_widget bound_field %} 
    76          </td> 
    77          {% endif %} 
    78       {% endfor %} 
    79       {% if bound_related_object.show_url %}<td> 
    80          {% if fcw.obj.original %}<a href="/r/{{ fcw.obj.original.content_type_id }}/{{ fcw.obj.original.id }}/">View on site</a>{% endif %} 
    81       </td>{% endif %} 
    82       </tr> 
    83  
    84    {% endfor %} </table> 
    85  
    86    {% for fcw in bound_related_object.form_field_collection_wrappers %} 
    87       {% for bound_field in fcw.bound_fields %} 
    88          {% if bound_field.hidden %} 
    89             {% field_widget bound_field %} 
    90          {% endif %} 
    91       {% endfor %} 
    92    {% endfor %} 
    93 </fieldset> 
    94 {% endcomment %} 
     57  </div> 
     58   
     59  {# <ul class="tools"> #} 
     60  {#   <li><a class="add" href="">Add another {{ inline_admin_formset.opts.verbose_name|title }}</a></li> #} 
     61  {# </ul> #} 
     62   
     63</div>