• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

bblanchon / django-phonenumber-field / 17148361819 / 4
97%
main: 97%

Build:
Build:
LAST BUILD BRANCH: phonenumberfield-topython
DEFAULT BRANCH: main
Ran 22 Aug 2025 07:00AM UTC
Files 8
Run time 0s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

22 Aug 2025 06:53AM UTC coverage: 97.429%. Remained the same
17148361819.4

push

github

francoisfreitag
Fix lost region when `PHONENUMBER_DEFAULT_FORMAT` is `NATIONAL`

When `PHONENUMBER_DEFAULT_FORMAT` is set to `NATIONAL`, you used to get a validation error after setting a `PhoneNumberField` to a phone number that is not in the default region.
This was because `PhoneNumberField` didn't override `to_python()`, so `CharField.to_python()` was called and returned `str(value)`.
Since `str(value)` returns a string in the `NATIONAL` format, the region information was lost.

I fixed this issue by overriding `to_python()` in  `PhoneNumberField`, ensuring that a `PhoneNumber` is returned.
This change forced me to move up the call to `super().get_prep_value()` because `CharField`'s implementation calls `self.to_python()`, which now returns a `PhoneNumber`.
This allowed me to remove `if isinstance(value, PhoneNumber)` in `get_prep_value()` since `value` is now always a `PhoneNumber`.

341 of 350 relevant lines covered (97.43%)

0.97 hits per line

Source Files on job Python 3.10 / - 17148361819.4
  • Tree
  • List 8
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 17148361819
  • d7d20ddb on github
  • Prev Job for on phonenumberfield-topython (#17148343460.6)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc