django-genc
A reusable Django app for working with GENC (Geopolitical Entities, Names, and Codes) country codes. Source data comes from the NGA site and the CIA World Fact Book.
Features
- Store and manage GENC country codes with their ISO equivalents
- Custom
CountryFieldthat accepts both 2-character and 3-character ISO and 3-character GENC codes - Admin interface integration
Installation
- Install the package:
pip install django-genc
- Add 'django_genc' to your INSTALLED_APPS:
INSTALLED_APPS = [
...
'django_genc.apps.GencConfig',
...
]
- Run migrations:
python manage.py migrate
Usage
Models
from django.db import models
from django_genc.models import CountryField
class MyModel(models.Model):
country = CountryField()
API
CountryField
A custom field that can handle both 2-digit ISO and 3-digit GENC codes.
from django_genc.models import CountryField
class MyModel(models.Model):
country = CountryField()
The field will:
- Store values as 3-digit GENC codes in the database
- Accept both 2-digit ISO and 3-digit GENC codes as input
- Automatically convert ISO codes to GENC codes
- Validate that the code exists in the database
CountryCode Model
The base model for storing country codes:
from django_genc.models import CountryCode
# Get a country by GENC code
country = CountryCode.objects.get(genc_code='USA')
# Get a country by ISO code
country = CountryCode.objects.get(iso_code='US')
# Look up a country by a code under either standard
country = CountryCode.objects.get_by_code('US')
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the Apache 2.0 License - see the LICENSE file for details.
Metadata
Release files for django-genc 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| django_genc-0.1.3.tar.gz | 40.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_genc-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 59.0 kB
Release files / django_genc-0.1.3.tar.gz
| Download URL | django_genc-0.1.3.tar.gz |
|---|---|
| Size | 40.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f50a0ae4aa3260f0af0a7d438027db338d2a8c082b0bdbec64fc18a30c0b1700
|
|
BLAKE2b-256 checksum How to use checksums |
458c1bb4650a9ad338c4aff72c39895d78cd7f949d0e0af0b03dede60a7bf9fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / django_genc-0.1.3-py3-none-any.whl
| Download URL | django_genc-0.1.3-py3-none-any.whl |
|---|---|
| Size | 18.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
259a2caed7ccda554e34f1460557363a9371164e9a1cbdba669afdd831dae0b8
|
|
BLAKE2b-256 checksum How to use checksums |
50879b3d6ddcfdfe4dbd1b326371b8dfeefe801deb35cfb1f82e453426e01bec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for django-genc 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.