Skip to main content

Django Locality Two - Countries and Territories

Project description

# django-locality-two

django-locality-two is a drop-in replacement for django-locality with modern python (3.5+) and django (1.11+) support, and more tests. Locality is a light collection of helpers for handling countries and territories in Django.

Currently, it includes:

## Installation

Install from the cheese shop

pip install django-locality-two

OR

Install from GitHub with pip:

pip install -e git+https://github.com/dekomote/django-locality-two.git#egg=django-locality-two==2.1.1

Then add locality to INSTALLED_APPS in your Django settings. To load the included data, run:

python manage.py loaddata locality

(or whichever equivalent method you use to run “manage.py” commands)

## Usage

List all countries:

>>> from locality.models import Country
>>> print Country.objects.all()
[<Country: Andorra>, <Country: United Arab Emirates>,
<Country: Antigua and Barbuda>, ...]

or list territories by country:

>>> from locality.models import Country
>>> for country in locality.models.Country.objects.all():
>>>     print country.territories.all()
...
[<Territory: Salta, Argentina>, <Territory: Buenos Aires, Argentina>,
<Territory: Ciudad Autónoma de Buen os Aires, Argentina>, ...]

You can create your own models around countries and territories:

class Address(models.Model):

country = models.ForeignKey(‘locality.models.Country’) territory = models.ForeignKey(‘locality.models.Territory’)

## Bugs / TODO

Please report all bugs to the [GitHub issue tracker](https://github.com/dekomote/django-locality-two/issues)

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-locality-two-2.2.tar.gz (18.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_locality_two-2.2-py3-none-any.whl (19.6 kB view details)

Uploaded Python 3

File details

Details for the file django-locality-two-2.2.tar.gz.

File metadata

  • Download URL: django-locality-two-2.2.tar.gz
  • Upload date:
  • Size: 18.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for django-locality-two-2.2.tar.gz
Algorithm Hash digest
SHA256 7b4fdbd9a318cfe2bb1ae3898706c59c7b5b19d015aaa3574b95e13ba594d97a
MD5 03fbd0cfe6dd9d1ee2e19e34af538174
BLAKE2b-256 6c9e270fda79779d19a6691e9242f2486aec991b0c764c8b416dde786c7f0e42

See more details on using hashes here.

File details

Details for the file django_locality_two-2.2-py3-none-any.whl.

File metadata

File hashes

Hashes for django_locality_two-2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 8191baa8337e119887b043d7ad7267d3c1df2a91c15337df20c3d44d68a12e93
MD5 f2306789fd1dec76ddc51f891d5f1eec
BLAKE2b-256 00cbaab1112295f28855dc6e9ceba66cb84cf6939ad382f51c128a68f78b2546

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page