1👍
✅
Django requires your phone field to not be null right now. This also means you can’t pass phone=None, so if your phone variable that you’re passing into your Order object is None, it will fail.
Your options are:
- Set a default value on the model
- Allow null on the model
- Pass in a non-null value to the model upon creation
0👍
Assuming from your question the model requires that phone number be there on creation.
Things you can do.
phone_number = models.PhoneField(null=True, blank=True)
phone_number = models.PhoneField(default='6132760547')
Those to model changes should help first is saying that the field can be blank as in contain an empty
or None
Second is if nothing is passed default value is that number.
- [Answer]-Django uploaded image cannot display in template
- [Answer]-Property of model to return iterable to template
- [Answer]-Extend Django User model
- [Answer]-How to handle form.non_field_errors and form.errors?
Source:stackexchange.com