Adds extra M49 data to django-countries.
Project description
django-countries-hdx
Adds extra M49 data to django-countries.
Installation
Install this library using pip
:
pip install django-countries-hdx
Usage
Extends django-countries to add region and sub-region, and SIDS, LLDC and LDC grouping data (as defined by the UN M49 Standard).
It also contains helper methods to retrieve the countries in a region or sub-region.
In[1]:
from django_countries.fields import Country
In[2]:
from django_countries_hdx import regions
In[3]: Country('NZ').region
Out[3]: '009'
In[4]: Country("NZ").region_name
Out[4]: 'Oceania'
In[5]: Country('NZ').subregion
Out[5]: '053'
In[6]: Country("NZ").subregion_name
Out[6]: 'Australia and New Zealand'
In[7]: regions.region_name('009')
Out[7]: 'Oceania'
In[8]: regions.subregion_name('053')
Out[8]: 'Australia and New Zealand'
In[9]: regions.countries_by_region('009')
Out[9]:
['AS',
'AU',
'CK',
# …
]
In[10]: regions.countries_by_subregion('053')
Out[10]: ['AU', 'NZ', 'NF']
Development
To contribute to this library, first checkout the code. Then create a new virtual environment:
cd django-countries-hdx
python -m venv .venv
source .venv/bin/activate
Now install the test dependencies:
pip install -e '.[test]'
To run the tests:
pytest
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django_countries_hdx-0.1.tar.gz
.
File metadata
- Download URL: django_countries_hdx-0.1.tar.gz
- Upload date:
- Size: 5.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 61dd19dab437bec313a7d267657a148491cb4abc5c616e3505c842a109750812 |
|
MD5 | 2c89442da33055838d6b2788cf5509f5 |
|
BLAKE2b-256 | 182810f50e607a6d0f9856056868018f218a076da60365247477f4cfcb6dc0b4 |
File details
Details for the file django_countries_hdx-0.1-py3-none-any.whl
.
File metadata
- Download URL: django_countries_hdx-0.1-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.10.14
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3d44920f766cf054faccdd9a660a5b7c0d52fac2bebf87668c367203482f300d |
|
MD5 | bc17b1db8a06fb25c473818f0553a36a |
|
BLAKE2b-256 | 1ebee8550eaedc6ea60ae8aae4c96390bc5305a039e591c128c4a62fbaa962ca |