Hello,
While setting up a new model I'm trying to have a strong data model.
One of the requirements is that a certain field cannot be null.
lastname = models.CharField(
blank=False,
default=None,
..)
I'm accomplishing this by the above code. This ensure that even on a database
level lastname will not be NULL, by setting default to None.
I'm aware that I can just use blank=False to ensure that on a form level it
will never be allowed to be empty. But I want a strong, fully tested, business
model from the beginning.
As this is a CharField, according to the docs, I cannot use null=True since
empty string will get stored as empty strings and not as NULL.
Is this an appropriate way of modeling my models, or are there other solutions ?
Regards,
Jonas.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.