Closed shawnngtq closed 2 years ago
# models.py
phone_number = PhoneNumberField(
blank=True,
help_text=_("Numeric values"),
null=True,
)
Still invalid even if I set blank and null true
Thanks for the report, I can reproduce the problem with the following form:
class TestForm(forms.Form):
phone = formfields.PhoneNumberField(
required=False, widget=PhoneNumberPrefixWidget
)
@francoisfreitag , how can I do monkey patch locally for this? for testing purpose only
Will it work if I create the same directory structure, location and validators.py
, then just modify that file?
If monkey patch is not recommended / impossible, what is the recommended way?
So that next time I can give better debug and maybe create pull request.
I used the project test suite to reproduce the issue: https://github.com/stefanfoulis/django-phonenumber-field/pull/512/files#diff-af3529af46c0c6d7c1c94af472ea2a6b21b19cc715c2c7207e53f1c8f7fc9bdaR135-R142
You should be able to pip install a pull request to experiment locally with:
pip install git+https://github.com/stefanfoulis/django-phonenumber-field.git@refs/pull/512/head
After updating from 6.1.0 to 6.2.0, my phonenumber inlineformset_factory throws form invalid for empty field.
The phone number entered is not valid.
If I revert to 6.1.0 OR exclude
phone_number
field, problem disappearI suspect it's due to update in
validators.py
/widgets.py
https://github.com/stefanfoulis/django-phonenumber-field/compare/6.1.0...6.2.0