answer is simple . Validator would like to check field which is used for Key. Look like this field is not set before validation. I would like take a look at model form and part of code before form.is_valid Many thanks,
Serge +380 636150445 skype: skhohlov On Fri, Nov 8, 2013 at 2:29 PM, DJ-Tom <[email protected]> wrote: > I still didn't get this to work... isn't there anybody that is able to help? > > Am Mittwoch, 30. Oktober 2013 10:47:34 UTC+1 schrieb DJ-Tom: >> >> Hi, >> >> given the following model field: >> >> room_setup = models.ForeignKey("roomsetup", verbose_name='Default room >> setup', blank=True, null=True, default='') >> >> In the modelform __init__ method I'm setting the choices for this field >> like this: >> >> self.fields['room_setup'].choices = roomsetups_as_choices(subevt) >> >> def roomsetups_as_choices(subevt): >> rs = [['', '-----']] >> for setup in roomsetup.objects.filter(Q(subevent__isnull=True) | >> Q(subevent=subevt)): >> rs.append([setup.id, setup.name]) >> >> return rs >> >> When adding a new record I keep getting the following validation message, >> but only for the first try to submit of the form: >> >> "Select a valid choice. That choice is not one of the available choices." >> >> It passes without error on the second try... I really don't understand >> why? >> >> IMHO it should not complain at all... >> >> Any ideas? >> >> Thomas > > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > 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/d6ff282b-aafa-411a-a5f6-00f6b6687e7a%40googlegroups.com. > > For more options, visit https://groups.google.com/groups/opt_out. -- 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 [email protected]. To post to this group, send email to [email protected]. 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/CADTRxJPyZgR24v3PpKbux9CbOX6aD5Z5zkoxWp-kcgzDA4HBxw%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.

