Code

Changes between Version 55 and Version 56 of NewformsHOWTO


Ignore:
Timestamp:
07/07/10 18:34:38 (4 years ago)
Author:
newacct
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • NewformsHOWTO

    v55 v56  
    660660from django.contrib import admin 
    661661from your_project.extras import new_index_method 
    662 import new 
     662import types 
    663663}}} 
    664664 
     
    666666{{{ 
    667667#!python 
    668 admin.site.index = new.instancemethod(new_index_method) 
     668admin.site.index = types.MethodType(new_index_method) 
    669669}}} 
    670670 
     
    687687A: You'll need to override the save_add method in your ModelAdmin. In the example below I've got a link on one 
    688688model's change form which points to the add view of another and passes along the GET variable "rep_id". 
    689 In the overriden method I check for this and tweak the location field of the HTTPResponseRedirect. Overriding  
     689In the overridden method I check for this and tweak the location field of the HTTPResponseRedirect. Overriding  
    690690save_add gives us the added advantage of having all validation etc performed beforehand for us. 
    691691