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

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

Build:
Build:
LAST BUILD BRANCH: phonenumberfield-topython
DEFAULT BRANCH: main
Ran 22 Aug 2025 06:54AM UTC
Jobs 6
Files 8
Run time 3min
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.436%. Remained the same
17148361819

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

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

342 of 351 relevant lines covered (97.44%)

5.83 hits per line

Jobs
ID Job ID Ran Files Coverage
1 Python 3.9 / - 17148361819.1 22 Aug 2025 07:00AM UTC 8
97.43
GitHub Action Run
2 Python 3.11 / - 17148361819.2 22 Aug 2025 07:00AM UTC 8
97.43
GitHub Action Run
3 Python 3.12 / - 17148361819.3 22 Aug 2025 07:00AM UTC 8
97.43
GitHub Action Run
4 Python 3.10 / - 17148361819.4 22 Aug 2025 07:00AM UTC 8
97.43
GitHub Action Run
5 Python 3.14-dev / - 17148361819.5 22 Aug 2025 07:00AM UTC 8
96.34
6 Python 3.13 / - 17148361819.6 22 Aug 2025 07:00AM UTC 8
96.34
Source Files on build 17148361819
  • Tree
  • List 8
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • d7d20ddb on github
  • Prev Build on phonenumberfield-topython (#17148343460)
  • 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

© 2025 Coveralls, Inc