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

kp-forks / django-phonenumber-field / 17152151602
97%

Build:
DEFAULT BRANCH: main
Ran 23 Aug 2025 08:15AM 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

22 Aug 2025 07:07AM UTC coverage: 97.436% (+1.1%) from 96.317%
17152151602

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%)

1 existing line in 1 file now uncovered.

342 of 351 relevant lines covered (97.44%)

5.83 hits per line

Uncovered Existing Lines

Lines Coverage ∆ File
1
98.98
0.96% phonenumber_field/phonenumber.py
Jobs
ID Job ID Ran Files Coverage
1 Python 3.9 / - 17152151602.1 24 Aug 2025 06:53AM UTC 8
97.43
GitHub Action Run
2 Python 3.14-dev / - 17152151602.2 24 Aug 2025 06:53AM UTC 8
96.34
3 Python 3.10 / - 17152151602.3 24 Aug 2025 06:53AM UTC 8
97.43
GitHub Action Run
4 Python 3.11 / - 17152151602.4 24 Aug 2025 06:53AM UTC 8
97.43
GitHub Action Run
5 Python 3.12 / - 17152151602.5 24 Aug 2025 06:53AM UTC 8
97.43
GitHub Action Run
6 Python 3.13 / - 17152151602.6 24 Aug 2025 06:53AM UTC 8
96.34
Source Files on build 17152151602
  • Tree
  • List 8
  • Changed 3
  • Source Changed 0
  • Coverage Changed 3
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • 58414464 on github
  • Prev Build on main (#14377586937)
  • Next Build on main (#18201282265)
  • 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