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

bblanchon / django-phonenumber-field / 16758153383
97%
main: 97%

Build:
Build:
LAST BUILD BRANCH: phonenumberfield-topython
DEFAULT BRANCH: main
Ran 05 Aug 2025 06:28PM UTC
Jobs 6
Files 8
Run time 1min
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

05 Aug 2025 06:25PM UTC coverage: 97.45%. Remained the same
16758153383

push

github

bblanchon
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`.

8 of 8 new or added lines in 1 file covered. (100.0%)

344 of 353 relevant lines covered (97.45%)

5.82 hits per line

Jobs
ID Job ID Ran Files Coverage
1 Python 3.9 / - 16758153383.1 05 Aug 2025 06:31PM UTC 8
97.44
GitHub Action Run
2 Python 3.10 / - 16758153383.2 05 Aug 2025 06:31PM UTC 8
97.44
GitHub Action Run
3 Python 3.14-dev / - 16758153383.3 05 Aug 2025 06:31PM UTC 8
96.09
4 Python 3.12 / - 16758153383.4 05 Aug 2025 06:31PM UTC 8
97.44
GitHub Action Run
5 Python 3.13 / - 16758153383.5 05 Aug 2025 06:31PM UTC 8
96.09
6 Python 3.11 / - 16758153383.6 05 Aug 2025 06:31PM UTC 8
97.44
GitHub Action Run
Source Files on build 16758153383
  • Tree
  • List 8
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • f9d681b2 on github
  • Prev Build on phonenumberfield-topython (#16758078580)
  • Next Build on phonenumberfield-topython (#16758458710)
  • 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