I am trying to create a limited selection field:
Action_Types=( ('0','foo'), ('1','bar'), ) class Foo(models.Model): myAction=models.CharField(max_length=1,choices=Action_Types) def __unicode__(self): return '%d %s'%(self.pk,self.myAction)
However, when I tried to insert content that violated the rules, it succeeded without any error messages or warnings (using the "manage.py" shell). It seems that any text of any length can be placed in this field. I am using SQLite3 as a backend.
Is this supposed to be so? Or if I missed something?
django sqlite maxlength model
Xun yang
source share