I've created a newforms form using form_for_model(). The problem I'm
having is that two fields are not respecting part of the field
definition in the model; I'm hoping I'm overlooking something.
The end result I want is for a scanner select-menu to show only
scanners, and a camera select-menu to show only cameras.
In my model (for an 'Item' being digitized), I've defined a scanner
field as:
scanner = models.ForeignKey(Equipment, null=True, blank=True,
limit_choices_to={'equipment_type__exact':'scan'},
related_name='scanner_set')
...and a camera field as:
camera = models.ForeignKey(Equipment, null=True, blank=True,
limit_choices_to={'equipment_type__exact':'camr'},
related_name='camera_set')
In the admin, the (beautiful) form that is generated respects this
definition perfectly: i.e. the scanner select-menu only shows
equipment entries that are scanners.
However, the scanner and camera select-menus generated by
{{form_reference.as_table}} in the template show all the 'Equipment'
entries, ignoring that 'limit-choices_to' model-constraint.
Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---