magic-removal: command stuff for stacked inline editing

git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@1771 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Robert Wittams 2005-12-23 13:40:09 +00:00
parent c017d60d15
commit 4d3374c652
4 changed files with 16 additions and 5 deletions

View File

@ -141,6 +141,10 @@ input[type=submit].default:active { background-image:url(../img/admin/default-bg
.submit-row input { margin:0 0 0 5px; }
.submit-row .float-left { padding-top:.1em; }
/* ACTIONS */
.actions { border-bottom:1px solid #eee; text-align:right; }
.collection { border-top: 1ex solid #7CA0C7; }
/* FORM ROWS */
.form-row { clear:both; padding:8px 12px; font-size:11px; }
html>body .form-row { border-bottom:1px solid #eee; }

View File

@ -12,5 +12,11 @@
{% admin_field_line bound_field %}
{% endif %}
{% endfor %}
<div class="item actions">
<button class="deletebutton" name="command" value="{{bound_related_object.relation.var_name}}.{{fcw.index}}.delete">Delete</button>
</div>
{% endfor %}
<div class="collection actions">
<button class="addbutton" name="command" value="{{bound_related_object.relation.var_name}}.add">Add</button>
</div>
</fieldset>

View File

@ -7,7 +7,7 @@
<th{{ fw.header_class_attribute }}>{{ fw.field.verbose_name|capfirst }}</th>
{% endif %}
{% endfor %}
<td><td>
<th><th>
</tr></thead>
{% for fcw in bound_related_object.form_field_collection_wrappers %}
{% if change %}{% if original_row_needed %}
@ -31,14 +31,15 @@
{% 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 %}
<td>
<td class="actions item" >
<button class="deletebutton" name="command" value="{{bound_related_object.relation.var_name}}.{{fcw.index}}.delete">Delete</button>
</td>
</tr>
{% endfor %} </table>
<div class="actions collection">
<button class="addbutton" name="command" value="{{bound_related_object.relation.var_name}}.add">Add</button>
</div>
{% for fcw in bound_related_object.form_field_collection_wrappers %}
{% for bound_field in fcw.bound_fields %}
{% if bound_field.hidden %}

View File

@ -139,8 +139,8 @@ class StackedBoundRelatedObject(BoundRelatedObject):
super(StackedBoundRelatedObject, self).__init__(related_object, field_mapping, original)
fields = self.relation.editable_fields()
self.field_mappings.fill()
self.form_field_collection_wrappers = [FormFieldCollectionWrapper(field_mapping ,fields)
for field_mapping in self.field_mappings]
self.form_field_collection_wrappers = [FormFieldCollectionWrapper(field_mapping ,fields, i)
for (i,field_mapping) in self.field_mappings.items()]
self.show_url = original and hasattr(self.relation.opts, 'get_absolute_url')
def template_name(self):