Skip to main content

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 CountryField that accepts both 2-character and 3-character ISO and 3-character GENC codes
  • Admin interface integration

Installation

  1. Install the package:
pip install django-genc
  1. Add 'django_genc' to your INSTALLED_APPS:
INSTALLED_APPS = [
    ...
    'django_genc.apps.GencConfig',
    ...
]
  1. 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)

Source distribution for django-genc 0.1.3
File Size Uploaded Provenance
django_genc-0.1.3.tar.gz 40.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for django-genc 0.1.3
File Interpreter ABI Platform
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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page