Changes between Version 18 and Version 19 of NewformsHOWTO


Ignore:
Timestamp:
02/21/08 06:06:50 (7 years ago)
Author:
Lllama <f.ingram.lists@…>
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • NewformsHOWTO

    v18 v19  
    554554        return super(ArticleOptions, self).change_view(request, obj_id)
    555555}}}
     556
     557== Q: How can I pass extra context variables into my add and change views? ==
     558
     559You can do this by overriding render_change_form in the ModelAdmin.
     560
     561{{{
     562#!python
     563class ArticleOptions(admin.ModelAdmin):
     564    save_on_top = True
     565
     566    def render_change_form(self, request, model, context, *args, **kwargs):
     567        extra = {
     568            'has_file_field': True # Make your form render as multi-part.
     569        }
     570
     571        context.update(extra)
     572       
     573        superclass = super(ReportOptions, self)
     574        return superclass.render_change_form(request, model, context, *args, **kwargs)
     575}}}
Back to Top