Hi.

Unfortunately 1.7 is unsupported version.

You should test with 1.11 to see if issue still exist.

28.10.2017 18.03 "Paul Kenjora" <pkenj...@gmail.com> kirjoitti:

> *I use:         *
>
> Django version 1.7.0 - I know I know :)
>
> Python 2.7.13
>
> - Paul
>
> On Sat, Oct 28, 2017 at 6:01 AM, Etienne Robillard <tkad...@yandex.com>
> wrote:
>
>> Which Python and Django versions do you use?
>>
>> Etienne
>>
>> Le 2017-10-27 à 23:27, Paul Kenjora a écrit :
>>
>> Hi,
>>
>>   When setting HiddenInput on a form widget for an integer model field
>> with choices, in tests I get 'X is not a valid choice' errors.  I'm
>> guessing it's the hidden input returning a STRING and the model expecting
>> an INT.
>>
>>   I have a model that has....
>>
>>
>> *class Banner(models.Model): *
>>
>> *  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.
>>
>> --
>> - Paul Kenjora
>> - 602-214-7285 <(602)%20214-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+unsubscr...@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/ms
>> gid/django-users/CAEH8JE3HuYObgFkpmVNnz39Gt7NMjJUX9jXsr9tenG
>> YhwgG_GA%40mail.gmail.com
>> <https://groups.google.com/d/msgid/django-users/CAEH8JE3HuYObgFkpmVNnz39Gt7NMjJUX9jXsr9tenGYhwgG_GA%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>> --
>> Etienne Robillardtkadm30@yandex.comhttp://www.isotopesoftware.ca/
>>
>>
>
>
> --
> - Paul Kenjora
> - 602-214-7285 <(602)%20214-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+unsubscr...@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/CAEH8JE3W7kL8g64ZAWcOEJg1kDO%
> 2Bv9X6_%2BXHMeTSEjt8vxLsBw%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CAEH8JE3W7kL8g64ZAWcOEJg1kDO%2Bv9X6_%2BXHMeTSEjt8vxLsBw%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@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/CAHn91ocsBS%2BePbLK8r51H1vHCpuhn%2BwUtnbWPaw2xKd%2B0bhmGA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to