{"id":31532637,"url":"https://github.com/makegov/django-genc","last_synced_at":"2025-10-12T05:08:35.190Z","repository":{"id":291009848,"uuid":"976297444","full_name":"makegov/django-genc","owner":"makegov","description":"A reusable django app to handle GENC codes","archived":false,"fork":false,"pushed_at":"2025-05-13T23:10:31.000Z","size":42,"stargazers_count":0,"open_issues_count":3,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-04T03:58:42.686Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/makegov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-05-01T21:20:12.000Z","updated_at":"2025-05-13T23:10:34.000Z","dependencies_parsed_at":"2025-05-01T21:49:53.525Z","dependency_job_id":"a45c71de-aeef-4f29-9939-af9f48d6ad5c","html_url":"https://github.com/makegov/django-genc","commit_stats":null,"previous_names":["makegov/django-genc"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/makegov/django-genc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makegov%2Fdjango-genc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makegov%2Fdjango-genc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makegov%2Fdjango-genc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makegov%2Fdjango-genc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/makegov","download_url":"https://codeload.github.com/makegov/django-genc/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/makegov%2Fdjango-genc/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278742889,"owners_count":26037915,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-07T02:00:06.786Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-10-04T03:57:15.369Z","updated_at":"2025-10-12T05:08:35.157Z","avatar_url":"https://github.com/makegov.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# django-genc\n\nA reusable Django app for working with GENC (Geopolitical Entities, Names, and Codes) country codes. Source data comes from the [NGA site](https://nsgreg.nga.mil/registries/browse/results.jsp?registryType=genc\u0026registerField=IE4\u0026itemTypeField=ggp\u0026gce=all\u0026field=name\u0026show=all\u0026status=all\u0026sort=nameasc) and the [CIA World Fact Book](https://www.cia.gov/the-world-factbook/references/country-data-codes/).\n\n## Features\n\n- Store and manage GENC country codes with their ISO equivalents\n- Custom `CountryField` that accepts both 2-character and 3-character ISO and 3-character GENC codes\n- Admin interface integration\n\n## Installation\n\n1. Install the package:\n\n```bash\npip install django-genc\n```\n\n2. Add 'django_genc' to your INSTALLED_APPS:\n\n```python\nINSTALLED_APPS = [\n    ...\n    'django_genc.apps.GencConfig',\n    ...\n]\n```\n\n3. Run migrations:\n\n```bash\npython manage.py migrate\n```\n\n## Usage\n\n### Models\n\n```python\nfrom django.db import models\nfrom django_genc.models import CountryField\n\nclass MyModel(models.Model):\n    country = CountryField()\n```\n\n## API\n\n### CountryField\n\nA custom field that can handle both 2-digit ISO and 3-digit GENC codes.\n\n```python\nfrom django_genc.models import CountryField\n\nclass MyModel(models.Model):\n    country = CountryField()\n```\n\nThe field will:\n- Store values as 3-digit GENC codes in the database\n- Accept both 2-digit ISO and 3-digit GENC codes as input\n- Automatically convert ISO codes to GENC codes\n- Validate that the code exists in the database\n\n### CountryCode Model\n\nThe base model for storing country codes:\n\n```python\nfrom django_genc.models import CountryCode\n\n# Get a country by GENC code\ncountry = CountryCode.objects.get(genc_code='USA')\n\n# Get a country by ISO code\ncountry = CountryCode.objects.get(iso_code='US')\n\n# Look up a country by a code under either standard\ncountry = CountryCode.objects.get_by_code('US')\n```\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n## License\n\nThis project is licensed under the Apache 2.0 License - see the LICENSE file for details. ","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmakegov%2Fdjango-genc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmakegov%2Fdjango-genc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmakegov%2Fdjango-genc/lists"}