Skip to content

feat: added local flavor for Qatar#544

Merged
benkonrath merged 1 commit intodjango:masterfrom
omaarsaaleh:qatar
Mar 30, 2026
Merged

feat: added local flavor for Qatar#544
benkonrath merged 1 commit intodjango:masterfrom
omaarsaaleh:qatar

Conversation

@omaarsaaleh
Copy link
Copy Markdown
Contributor

@omaarsaaleh omaarsaaleh commented Mar 14, 2026

Add Qatar localflavor support

This PR adds complete localflavor support for the Qatar

Form Fields:

  • QANationalIDNumberField – Validates 11-digit Qatar ID numbers in the format CYYNNNSSSSS.
  • QAMunicipalityField – Choice field for selecting from the 8 Qatar municipalities using ISO 3166-2:QA codes.

Model Fields:

  • Corresponding model fields for all form fields with appropriate max_lengths and validation

Implementation Notes

  • Municipality input accepts ISO codes, English names, and Arabic names, and stores ISO 3166-2:QA codes.
  • Nationality checks in the National ID validator use ISO 3166-1 numeric country codes, which have been added to iso_3166.py.

Resources

Qatar National ID Format

Qatar Municipalities

All Changes

  • Add an entry to the docs/changelog.rst describing the change.

  • Add an entry for your name in the docs/authors.rst file if it's not
    already there.

New Fields Only

  • Prefix the country code to all fields.

  • Field names should be easily understood by developers from the target
    localflavor country. This means that English translations are usually
    not the best name unless it's for something standard like postal code,
    tax / VAT ID etc.

  • Prefer 'PostalCodeField' for postal codes as it's
    international English; ZipCode is a term specific to the United
    States postal system.

  • Add meaningful tests. 100% test coverage is not required but all
    validation edge cases should be covered.

  • Add .. versionadded:: <next-version> comment markers to new
    localflavors.

  • Add documentation for all fields.

Signed-off-by: Omar Saleh <omaarsaaleh1@gmail.com>
@omaarsaaleh
Copy link
Copy Markdown
Contributor Author

Just pinging here, it should pass the tests now. Sorry for the disruption

@benkonrath benkonrath self-requested a review March 25, 2026 06:16
@benkonrath
Copy link
Copy Markdown
Member

No problem, thanks for the ping.

@benkonrath
Copy link
Copy Markdown
Member

I'll have time to look over this early next week. Thanks for your patience.

Copy link
Copy Markdown
Member

@benkonrath benkonrath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@benkonrath benkonrath merged commit c494823 into django:master Mar 30, 2026
7 checks passed
@benkonrath
Copy link
Copy Markdown
Member

Thank you for your contribution. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants