python - Adding null=True , blank=True in custom model field -
i using custom modelfield language. snippet shown -
from django.conf import settings class languagefield(models.charfield): def __init__(self, *args, **kwargs): kwargs.setdefault('max_length', 5) kwargs.setdefault('choices', settings.languages) super(languagefield, self).__init__(*args, **kwargs) def get_internal_type(self): return "charfield"
i want allow null values language. so, know 1 thing have append ((none,"none"),) choices display none option in dropdown. how set null=true , blank=true field.
language=languagefield(null=true,blank=true)
doesnot works.it gives error column 'language' cannot null
Comments
Post a Comment