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

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

Build:
Build:
LAST BUILD BRANCH: phonenumberfield-topython
DEFAULT BRANCH: main
Repo Added 05 Aug 2025 06:25PM UTC
Token d4SP2FIXaaqrjfg78g6DRmrdE14IHrd94 regen
Build 6 Last
Files 8
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

LAST BUILD ON BRANCH phonenumberfield-topython
branch: SELECT
CHANGE BRANCH
x
Sync Branches
  • No branch selected
  • phonenumberfield-topython

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

Relevant lines Covered
Build:
Build:
351 RELEVANT LINES 342 COVERED LINES
5.83 HITS PER LINE
Source Files on phonenumberfield-topython
  • Tree
  • List 8
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line

Recent builds

Builds Branch Commit Type Ran Committer Via Coverage
17148361819 phonenumberfield-topython 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. Thi... push 22 Aug 2025 06:54AM UTC francoisfreitag github
97.44
17148343460 phonenumberfield-topython Revert "Add mypy to the CI" This reverts commit c3a31bb79. Mypy itself crashes on the tip of the branch, and it provides little value in its current state. ``` $ mypy tests --no-check-untyped-defs /home/runner/wor... push 22 Aug 2025 06:54AM UTC francoisfreitag github
97.44
16803895640 phonenumberfield-topython 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. Thi... push 07 Aug 2025 12:03PM UTC francoisfreitag github
97.42
16758458710 phonenumberfield-topython 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. Thi... push 05 Aug 2025 06:43PM UTC bblanchon github
97.45
16758153383 phonenumberfield-topython 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. Thi... push 05 Aug 2025 06:28PM UTC bblanchon github
97.45
16758078580 phonenumberfield-topython Fix lost region when `PHONENUMBER_DEFAULT_FORMAT` is `NATIONAL` When `PHONENUMBER_DEFAULT_FORMAT` is set `NATIONAL`, you used to get a validation error after setting a `PhoneNumberField` to a phone number that is not in the default region. This w... push 05 Aug 2025 06:25PM UTC bblanchon github
97.45
See All Builds (6)

Badge your Repo: django-phonenumber-field

We detected this repo isn’t badged! Grab the embed code to the right, add it to your repo to show off your code coverage, and when the badge is live hit the refresh button to remove this message.

Could not find badge in README.

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

Refresh
  • Settings
  • Repo on GitHub
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