-
Notifications
You must be signed in to change notification settings - Fork 316
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
If blank=True, it's impossible to save an empty phone number #1
Comments
empy values are saved as NULL, so you'll need to define the field like this:
I added an example of an optional field in the README. |
Ok, thanks for your comment, but, in the Django documentation, you can find a specific comment about null usage: https://docs.djangoproject.com/en/dev/ref/models/fields/#null Moreover, in your example, you should add this line at the beginning: from phonenumber_field.modelfields import PhoneNumberField |
thanks for the pointer. I added it to the README. I agree, there is actually no reason anymore to distinguish between I'll re-open the ticket. Thanks for reporting :-) |
This confused me, too. Specifying blank=True by itself should make the field optional. Thank you for developing this field! |
Same problem here. I agree with @sethlivingston. |
I have another problem with that bug.
It's generate migration sql (Django 1.7):
It's incorrect SQL because when i save new model instance i get an exception (with unique constrain). Correct migration must be:
|
It is fixed and tested. |
…patch-1 pt/LC_MESSAGE complete po translaction
So I'm using version 2.0.0 of this module and seem to be having the same problem of this issue. I have a model field defined like:
However, when I submit a ModelForm without sending a value for "phone", the form is valid but when I try to save the model I get:
Is this a different problem? |
If you define a field like this in your models.py:
The text was updated successfully, but these errors were encountered: