Re: ModelMultipleChoiceField ignore invalid choices?
This could be handled in the form clean() and/or save() methods using a try/catch block and passing on thrown exceptions. You'd have to figure out what would be an acceptable way to handle a form submission with an invalid selection, though.
On Monday, October 7, 2013 11:15:43 AM UTC-5, Jon Dufresne wrote:
-- On Monday, October 7, 2013 11:15:43 AM UTC-5, Jon Dufresne wrote:
Hi,
I am using a ModelForm with a ModelMultipleChoiceField. I would like
for this field to silently ignore invalid choices instead of creating
a form error. Here is my use case:
* User A opens form select model choice 1, 2, and 3
* User B (different browser) deletes model choice 3 entirely from system
* User A submits form and receives error
I understand why this should be an error in the general case, but in
my case, I want this to silently ignore the invalid choice 3 and
continue with choice 1 and 2? Is this possible?
Thanks,
Jon
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/2265a481-1774-4c0f-9e9b-dd2ff3e9b306%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home