On 21/03/2016 7:29 PM, Amine Yaiche wrote:
Hi everyone,
Given a field in a model that uses choices:
|
CHOICES =(
  (0,"choice_0"),
  (1,"choice_1")
)
foo =models.IntegerField(choices=CHOICES)
|
If i put a value other than 0 or 1, django will accept it. Is that
possible that we instruct
The choices don't enforce any default validation. But if you are populating
the data from a http call then use ModelForm they show the invalid_choice
error message on entering value other than defined choices
On Mon, Mar 21, 2016 at 1:59 PM, Amine Yaiche wrote:
> Hi everyone,
>
> Given a field i
Hi everyone,
Given a field in a model that uses choices:
CHOICES = (
(0, "choice_0"),
(1, "choice_1")
)
foo = models.IntegerField(choices=CHOICES)
If i put a value other than 0 or 1, django will accept it. Is that possible
that we instruct Django to accept only values that are mention
3 matches
Mail list logo