Re: Django models choices

2016-03-21 Thread Mike Dewhirst
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

Re: Django models choices

2016-03-21 Thread Amandeep Singh
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