Django

Code

Changeset 6247

Show
Ignore:
Timestamp:
09/14/07 18:15:40 (1 year ago)
Author:
adrian
Message:

Fixed #5432 -- Added docs/form_preview.txt. Thanks, ryankanno

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/AUTHORS

    r6211 r6247  
    253253    Brian Rosner <brosner@gmail.com> 
    254254    Oliver Rutherfurd <http://rutherfurd.net/> 
     255    ryankanno 
    255256    Ivan Sagalaev (Maniac) <http://www.softwaremaniacs.org/> 
    256257    Vinay Sajip <vinay_sajip@yahoo.co.uk> 
  • django/trunk/django/contrib/formtools/preview.py

    r5293 r6247  
    11""" 
    22Formtools Preview application. 
    3  
    4 This is an abstraction of the following workflow: 
    5  
    6     "Display an HTML form, force a preview, then do something with the submission." 
    7  
    8 Given a django.newforms.Form object that you define, this takes care of the 
    9 following: 
    10  
    11     * Displays the form as HTML on a Web page. 
    12     * Validates the form data once it's submitted via POST. 
    13         * If it's valid, displays a preview page. 
    14         * If it's not valid, redisplays the form with error messages. 
    15     * At the preview page, if the preview confirmation button is pressed, calls 
    16       a hook that you define -- a done() method. 
    17  
    18 The framework enforces the required preview by passing a shared-secret hash to 
    19 the preview page. If somebody tweaks the form parameters on the preview page, 
    20 the form submission will fail the hash comparison test. 
    21  
    22 Usage 
    23 ===== 
    24  
    25 Subclass FormPreview and define a done() method: 
    26  
    27     def done(self, request, cleaned_data): 
    28         # ... 
    29  
    30 This method takes an HttpRequest object and a dictionary of the form data after 
    31 it has been validated and cleaned. It should return an HttpResponseRedirect. 
    32  
    33 Then, just instantiate your FormPreview subclass by passing it a Form class, 
    34 and pass that to your URLconf, like so: 
    35  
    36     (r'^post/$', MyFormPreview(MyForm)), 
    37  
    38 The FormPreview class has a few other hooks. See the docstrings in the source 
    39 code below. 
    40  
    41 The framework also uses two templates: 'formtools/preview.html' and 
    42 'formtools/form.html'. You can override these by setting 'preview_template' and 
    43 'form_template' attributes on your FormPreview subclass. See 
    44 django/contrib/formtools/templates for the default templates. 
    453""" 
    464 
  • django/trunk/docs/add_ons.txt

    r5985 r6247  
    7171"Display an HTML form, force a preview, then do something with the submission." 
    7272 
    73 Full documentation for this feature does not yet exist, but you can read the 
    74 code and docstrings in ``django/contrib/formtools/preview.py`` for a start. 
     73See the `form preview documentation`_. 
     74 
     75.. _form preview documentation: ../form_preview/ 
    7576 
    7677humanize