banner_x = models.PositiveIntegerField(blank=False, default=0, choices=enumerate(BANNER_XS))
And a form that has....
class BannerForm(forms.ModelForm):
class Meta:
model = Banner
fields = ['banner_x']
def __init__(self, *args, **kwargs):
kwargs['prefix'] = 'banner'
super(BannerForm, self).__init__(*args, **kwargs)
self.fields['banner_x'].widget = forms.HiddenInput()
In my unit tests I always get the error:
resp = self.client.post('/banner/, {
'banner-banner_x':0,
}, follow=True)
<ul class="errorlist"><li>banner_x<ul class="errorlist"><li>Select a valid choice. 0 is not one of the available choices.</li></ul>
Anyone else seeing this? Works fine via browser, just unit tests are not coming back right.
- 602-214-7285
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 https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAEH8JE3HuYObgFkpmVNnz39Gt7NMjJUX9jXsr9tenGYhwgG_GA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment