Changes between Version 27 and Version 28 of NewAdminChanges
- Timestamp:
- Jul 20, 2006, 3:13:54 AM (18 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
NewAdminChanges
v27 v28 44 44 manipulator.do_html2python(new_data) # WRONG!! 45 45 manipulator.save(new_data) 46 return HttpResponseRedirect( "")46 return HttpResponseRedirect("") 47 47 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. 49 49 new_data = manipulator.original_object.__dict__ # WRONG!! 50 50 errors = {} … … 74 74 if not errors: 75 75 manipulator.save(new_data) 76 return HttpResponseRedirect( "")76 return HttpResponseRedirect("") 77 77 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. 79 79 new_data = manipulator.flatten_data() # CORRECT!! 80 80 errors = {} … … 161 161 'choices' : True, 162 162 } 163 manipulator = styles.ChangeManipulator(object_id, follow)# <------ EXTRA ARGUMENT163 manipulator = styles.ChangeManipulator(object_id, follow)# <------ EXTRA ARGUMENT 164 164 except ObjectDoesNotExist: 165 165 raise Http404 … … 173 173 if not errors: 174 174 manipulator.save(new_data) 175 return HttpResponseRedirect( "")175 return HttpResponseRedirect("") 176 176 else: 177 # Populate new_data with a "flattened"version of the current data.177 # Populate new_data with a "flattened" version of the current data. 178 178 new_data = manipulator.flatten_data() 179 179 errors = {} … … 181 181 182 182 # Populate the FormWrapper. 183 form = formfields.FormWrapper(manipulator, new_data, errors, edit_inline = True) # <----- EXTRA ARGUMENT183 form = formfields.FormWrapper(manipulator, new_data, errors, edit_inline = True) # <----- EXTRA ARGUMENT 184 184 185 185 … … 217 217 ... 218 218 def monkey_tag(verb): 219 return "I %s no evil"% verb219 return "I %s no evil" % verb 220 220 monkey_tag = simple_tag(monkey_tag) 221 221 … … 225 225 {{{ 226 226 {% load monkey %} 227 {% monkey_tag "hear"%}227 {% monkey_tag "hear" %} 228 228 }}} 229 229 … … 236 236 An 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 : 237 237 238 * admin/ <app_label>/<object_name>/change_form239 * admin/ <app_label>/change_form238 * admin/<app_label>/<object_name>/change_form 239 * admin/<app_label>/change_form 240 240 * admin/change_form 241 241 … … 248 248 {{{ 249 249 250 {%extends "admin/change_form"%}250 {%extends "admin/change_form" %} 251 251 252 252 {% block branding %} Customised title {% endblock %} … … 255 255 }}} 256 256 257 This 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").257 This 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" ). 258 258 259 259 In the change forms, the following blocks are available for custom overriding: 260 260 261 * branding - included from "admin/base"261 * branding - included from "admin/base" 262 262 * form_top - at the top of the form after the title. 263 263 * after_field_sets - after standard field sets, before the related objects … … 266 266 267 267 Inline 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