Changes between Version 27 and Version 28 of NewAdminChanges


Ignore:
Timestamp:
07/20/2006 03:13:54 AM (9 years ago)
Author:
anonymous
Comment:

Undoing last change

Legend:

Unmodified
Added
Removed
Modified
  • NewAdminChanges

    v27 v28  
    4444            manipulator.do_html2python(new_data)   # WRONG!!
    4545            manipulator.save(new_data)
    46             return HttpResponseRedirect("")
     46            return HttpResponseRedirect("")
    4747    else:
    48         # Populate new_data with a "flattened" version of the current data.
     48        # Populate new_data with a "flattened" version of the current data.
    4949        new_data = manipulator.original_object.__dict__ # WRONG!!
    5050        errors = {}
     
    7474        if not errors:
    7575            manipulator.save(new_data)
    76             return HttpResponseRedirect("")
     76            return HttpResponseRedirect("")
    7777    else:
    78         # Populate new_data with a "flattened" version of the current data.
     78        # Populate new_data with a "flattened" version of the current data.
    7979        new_data = manipulator.flatten_data() # CORRECT!!
    8080        errors = {}
     
    161161           'choices' : True,
    162162        }
    163         manipulator = styles.ChangeManipulator(object_id, follow)# <------ EXTRA ARGUMENT
     163        manipulator = styles.ChangeManipulator(object_id, follow)# <------ EXTRA ARGUMENT
    164164    except ObjectDoesNotExist:
    165165        raise Http404
     
    173173        if not errors:
    174174            manipulator.save(new_data)
    175             return HttpResponseRedirect(&#34;&#34;)
     175            return HttpResponseRedirect("")
    176176    else:
    177         # Populate new_data with a &#34;flattened&#34; version of the current data.
     177        # Populate new_data with a "flattened" version of the current data.
    178178        new_data = manipulator.flatten_data()
    179179        errors = {}
     
    181181
    182182    # Populate the FormWrapper.
    183     form = formfields.FormWrapper(manipulator, new_data, errors, edit_inline = True) # &lt;----- EXTRA ARGUMENT
     183    form = formfields.FormWrapper(manipulator, new_data, errors, edit_inline = True) # <----- EXTRA ARGUMENT
    184184   
    185185 
     
    217217...
    218218def monkey_tag(verb):
    219     return &#34;I %s no evil&#34; % verb
     219    return "I %s no evil" % verb
    220220monkey_tag = simple_tag(monkey_tag)
    221221
     
    225225{{{
    226226{% load monkey %}
    227 {% monkey_tag &#34;hear&#34; %}
     227{% monkey_tag "hear" %}
    228228}}}
    229229
     
    236236An example is change forms - these are the forms used to modify and add objects in the admin. The templates are selected in the following order :
    237237
    238  * admin/&lt;app_label&gt;/&lt;object_name&gt;/change_form
    239  * admin/&lt;app_label&gt;/change_form
     238 * admin/<app_label>/<object_name>/change_form
     239 * admin/<app_label>/change_form
    240240 * admin/change_form
    241241
     
    248248{{{
    249249
    250 {%extends &#34;admin/change_form&#34; %}
     250{%extends "admin/change_form" %}
    251251
    252252{% block branding %} Customised title {% endblock %}
     
    255255}}}
    256256
    257 This works using normal template inheritance, so make sure you inherit from the right thing ( usually &#34;admin/change_form&#34;, but for an object in an app that has its own change form, it may be &#34;admin/&lt;app_name&gt;/change_form&#34; ). 
     257This works using normal template inheritance, so make sure you inherit from the right thing ( usually "admin/change_form", but for an object in an app that has its own change form, it may be "admin/<app_name>/change_form" ). 
    258258
    259259In  the change forms, the following blocks are available for custom overriding:
    260260
    261  * branding - included from &#34;admin/base&#34;
     261 * branding - included from "admin/base"
    262262 * form_top - at the top of the form after the title.
    263263 * after_field_sets - after standard field sets, before the related objects
     
    266266
    267267Inline editing can be customised. rather than using edit_inline=meta.TABULAR or meta.SOURCE, you can define a custom inline editing mode. This is done by subclassing BoundRelatedObject, and using that class. eg edit_inline=HorizontalScroller.
    268 862796798698
Back to Top