-
Notifications
You must be signed in to change notification settings - Fork 319
Allow configuring empty_value for SplitPhoneNumberField #632
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
base: main
Are you sure you want to change the base?
Conversation
I've seen your message only recently, I'll investigate this issue. |
97f6c63
to
1c180a3
Compare
1c180a3
to
c3a0973
Compare
Investigated the issue. From the commit message:
@ilkkao, when you have the chance, could you try out this branch in your project and confirm it solves your issue? Since your field is nullable, you might need to subclass the |
I'll add a reminder for myself to comment in couple weeks. I'm travelling currently. |
Thanks! |
I believe the PR is ready for testing. After that, I realized it wasn't enough to use the field with |
Previous behavior was to return an empty list for no data, which is surprising and cannot be saved to a django.db.models.CharField in the database. Following django.forms.CharField behavior, accepts an empty_value, defaulting to the empty string.
Allow using the field with `fields_for_model`, `ModelForm`, …
045d6b5
to
76da570
Compare
I'm not sure at all if this my mistake or a real issue. But thought it's easiest to explain it as a PR.
Without this fix, in my django app, a string
[]
gets saved to thephone_number
model view when nothing is entered to the form SplitPhoneNumberField. Model field is defined as:Field in my form:
In my view I just call