Ticket #494: 494.2.patch

File 494.2.patch, 4.2 KB (added by Antonis Christofides <anthony@…>, 17 years ago)

Updated patch, fixing a documentation problem

  • django/db/models/fields/related.py

     
    1717    from sets import Set as set   # Python 2.3 fallback
    1818
    1919# Values for Relation.edit_inline.
    20 TABULAR, STACKED = 1, 2
     20TABULAR, STACKED = 'inline_tabular ', 'inline_stacked '
    2121
    2222RECURSIVE_RELATIONSHIP_CONSTANT = 'self'
    2323
  • django/contrib/admin/templatetags/admin_modify.py

     
    166166    def render(self, context):
    167167        relation = self.rel_var.resolve(context)
    168168        context.push()
    169         if relation.field.rel.edit_inline == models.TABULAR:
     169        edit_inline = relation.field.rel.edit_inline
     170        if edit_inline.startswith(models.TABULAR):
    170171            bound_related_object_class = TabularBoundRelatedObject
    171         elif relation.field.rel.edit_inline == models.STACKED:
     172            edit_inline = edit_inline[len(models.TABULAR):]
     173        elif edit_inline.startswith(models.STACKED):
    172174            bound_related_object_class = StackedBoundRelatedObject
     175            edit_inline = edit_inline[len(models.STACKED):]
    173176        else:
    174177            bound_related_object_class = relation.field.rel.edit_inline
    175178        original = context.get('original', None)
    176179        bound_related_object = relation.bind(context['form'], original, bound_related_object_class)
    177180        context['bound_related_object'] = bound_related_object
     181        context['extra_classes'] = edit_inline
    178182        t = loader.get_template(bound_related_object.template_name())
    179183        output = t.render(context)
    180184        context.pop()
  • django/contrib/admin/templates/admin/edit_inline_stacked.html

     
    11{% load admin_modify %}
    2 <fieldset class="module aligned">
     2<fieldset class="module aligned {{extra_classes}}">
    33   {% for fcw in bound_related_object.form_field_collection_wrappers %}
    44      <h2>{{ bound_related_object.relation.opts.verbose_name|capfirst }}&nbsp;#{{ forloop.counter }}</h2>
    55      {% if bound_related_object.show_url %}{% if fcw.obj.original %}
  • django/contrib/admin/templates/admin/edit_inline_tabular.html

     
    11{% load admin_modify %}
    2 <fieldset class="module">
     2<fieldset class="module {{extra_classes}}">
    33   <h2>{{ bound_related_object.relation.opts.verbose_name_plural|capfirst }}</h2><table>
    44   <thead><tr>
    55   {% for fw in bound_related_object.field_wrapper_list %}
  • docs/model-api.txt

     
    818818                             interface. Use either ``models.TABULAR`` or ``models.STACKED``,
    819819                             which, respectively, designate whether the inline-editable
    820820                             objects are displayed as a table or as a "stack" of
    821                              fieldsets.
     821                             fieldsets.  You can append a string specifying extra CSS
     822                             classes to be used for the inline fieldsets; the
     823                             ``collapse`` and ``wide`` classes, documented below, are
     824                             useful. For example::
    822825
     826                                edit_inline = models.TABULAR + 'collapse'
     827
    823828    ``limit_choices_to``     A dictionary of lookup arguments and values (see
    824829                             the `Database API reference`_) that limit the
    825830                             available admin choices for this object. Use this
Back to Top