Form hidden filed for foreign key - validation error
I want to have foreign key in form displayed as hidden field. I will
be using javascript to populate this field.
Model is defined as:
contactid = models.ForeignKey(Contact, blank = True, null = True,
on_delete = models.PROTECT)
I tried to define form field as:
contactid = ModelChoiceField(queryset=Contact.objects.all(),
widget=HiddenInput())
but I then get validation error (This field is required.).
Is there way to display foreign key form field as input (hidden)?
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home