Ticket #4363: preview.diff

File preview.diff, 1.1 KB (added by Indy, 17 years ago)
  • django/contrib/formtools/preview.py

     
    9191
    9292    def preview_get(self, request):
    9393        "Displays the form"
    94         f = self.form(auto_id=AUTO_ID)
     94        f = self.form(auto_id=AUTO_ID, initial=self.initial(request))
    9595        return render_to_response(self.form_template,
    9696            {'form': f, 'stage_field': self.unused_name('stage'), 'state': self.state},
    9797            context_instance=RequestContext(request))
     
    121121
    122122    # METHODS SUBCLASSES MIGHT OVERRIDE IF APPROPRIATE ########################
    123123
     124    def initial(self, request):
     125        """
     126        Returns dynamic initial values for the given Form instance.
     127       
     128        The return value should be a dictionary mapping field names to
     129        initial values.
     130        """
     131        return None
     132
    124133    def parse_params(self, *args, **kwargs):
    125134        """
    126135        Given captured args and kwargs from the URLconf, saves something in
Back to Top