Changes between Version 11 and Version 12 of AJAXWidgetComboBox


Ignore:
Timestamp:
08/21/2007 06:53:30 PM (8 years ago)
Author:
Matthew Flanagan <mattimustang@…>
Comment:

reverted vandalism

Legend:

Unmodified
Added
Removed
Modified
  • AJAXWidgetComboBox

    v11 v12  
    1919== Requirements ==
    2020
    21 {{{
     21 * [http://dojotoolkit.org Dojo 0.3.1] - used for AJAX and widget implementation. 
     22 * The [http://code.djangoproject.com/attachment/wiki/AJAXWidgetComboBox/nongselect-1.0.tar.gz NongSelect 1.0 widget tarball] attached to this page.
     23
     24
     25== Installation ==
     26
     27 * Install Dojo in media/js.
     28 * Untar nongselect-1.0.tar.gz and copy the {{{nong}}} directory into the same parent directory as dojo and copy the contents of {{{views.py}}} into one of your own {{{views.py}}} files.
     29
     30My project layout is as follows:
     31
     32{{{
     33myproject/
     34    myapp/
     35        models.py
     36        views.py
     37        urls.py
     38    templatetags/
     39        formtags.py
     40    templates/
     41        myapp/
     42            mymodel_form.html
     43        widget/
     44            fieldrow.html
     45            selectrow.html
     46    media/
     47        js/
     48        dojo/
     49        nong/
     50}}}
     51
     52
     53== Example Use ==
     54
     55In this example we will create a form that uses the Select widget to for the Article's reporter field in below.
     56
     57=== Model ===
     58Using the example model from [http://www.djangoproject.com/documentation/models/many_to_one/ Model Examples]:
     59
     60{{{
     61#!python
     62from django.db import models
     63
     64class Reporter(models.Model):
     65    first_name = models.CharField(maxlength=30)
     66    last_name = models.CharField(maxlength=30)
     67    email = models.EmailField()
     68
     69    def __str__(self):
     70        return "%s %s" % (self.first_name, self.last_name)
     71
     72class Article(models.Model):
     73    headline = models.CharField(maxlength=100)
     74    pub_date = models.DateField()
     75    reporter = models.ForeignKey(Reporter)
     76
    2277    def __str__(self):
    2378        return self.headline
Back to Top