Changes between Version 3 and Version 4 of AJAXForeignKey


Ignore:
Timestamp:
May 20, 2007, 4:31:31 PM (18 years ago)
Author:
Michael Axiak <axiak@…>
Comment:

Added ajax_str

Legend:

Unmodified
Added
Removed
Modified
  • AJAXForeignKey

    v3 v4  
    6868=== Using it in your models ===
    6969
     70To use, you need to define a {{{ajax_autocomplete(data)}}} (either in {{{Model}}} or {{{Model.objects}}}) and an {{{ajax_str}}}.
     71
    7072Below is an example usage in some models:
    7173
     
    8486    pub_date = models.DateTimeField('date published')
    8587
     88    # this is how it displays in the autocompletion...should be related to
     89    # how the person filters above
     90    def ajax_str(self):
     91        return self.question
     92
    8693class Choice(models.Model):
    8794    # notice it's the same syntax as models.ForeignKey
Back to Top