Changes between Version 9 and Version 10 of AJAXWidgetComboBox


Ignore:
Timestamp:
08/10/2007 05:04:20 AM (8 years ago)
Author:
anonymous
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AJAXWidgetComboBox

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