Changes between Version 6 and Version 7 of AJAXWidgetComboBox


Ignore:
Timestamp:
Aug 30, 2006, 11:17:20 PM (18 years ago)
Author:
mattimustang@…
Comment:

minor formatting fixes

Legend:

Unmodified
Added
Removed
Modified
  • AJAXWidgetComboBox

    v6 v7  
    1 = An AJAX !Select Widget for Django =
     1= An AJAX Select Widget for Django =
    22
    3 This widget was written to replace the standard {{{<select>}}} form element Django uses for releated objects in forms. The widget is an extended version of the [http://dojotoolkit.org Dojo] !Select widget. I use this mostly in places where the number of objects in the related objects table exceeds 20 or more. The widget is extracted from a project where some tables have more than 30,000 objects and using a {{{<select>}}} dropdown simply did not scale.
     3This widget was written to replace the standard {{{<select>}}} form element Django uses for releated objects in forms. The widget is an extended version of the [http://dojotoolkit.org Dojo] Select widget. I use this mostly in places where the number of objects in the related objects table exceeds 20 or more. The widget is extracted from a project where some tables have more than 30,000 objects and using a {{{<select>}}} dropdown simply did not scale.
    44       
    55This widget supports live lookup of related fields based on a single field in that model and autocompletion.
     
    3838        views.py
    3939        urls.py
     40        templatetags/
     41            formtags.py
    4042        templates/
    4143            myapp/
    4244                mymodel_form.html
     45            widget/
     46                fieldrow.html
     47                selectrow.html
    4348    media/
    4449        js/
     
    5055== Example Use ==
    5156
    52 In this example we will create a form that uses the !Select widget to for the Article's reporter field in below.
     57In this example we will create a form that uses the Select widget to for the Article's reporter field in below.
    5358 
    5459=== Model ===
     
    103108=== Template ===
    104109
    105 Normally you would have just put {{{{{ form.reporter }}}}} somewhere in your {{{article_form.html}}} template to get a drop down menu with a list of the Reporters. To use the new widget in your form you'll need to add the following to your template:
     110Normally you would have just put {{{{{ form.reporter }}}}} somewhere in your {{{article_form.html}}} template to get a drop down menu with a list of the Reporters. To use the new widget in your form you'll need to add the following javascript and templatetags to your template:
    106111
    107112{{{
     
    124129Two templatetags are included for your convenience. The first, {% fieldrow ... %} splits out a form element similar in style to the
    125130Django Admin with the field's help_text displayed.
    126 The second, {% selectrow ... %}, splits out all the markup and javascript necessary for the AJAX selet widget.
     131The second, {% selectrow ... %}, splits out all the markup and javascript necessary for the AJAX select widget.
    127132
    128133Replace the usual {{ form.reporter }} element in the template with this:
Back to Top