django-chile-cities 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- django_chile_cities-1.0.0/LICENSE +29 -0
- django_chile_cities-1.0.0/MANIFEST.in +5 -0
- django_chile_cities-1.0.0/PKG-INFO +81 -0
- django_chile_cities-1.0.0/README.md +50 -0
- django_chile_cities-1.0.0/README.rst +51 -0
- django_chile_cities-1.0.0/django_chile_cities/__init__.py +0 -0
- django_chile_cities-1.0.0/django_chile_cities/admin.py +3 -0
- django_chile_cities-1.0.0/django_chile_cities/apps.py +5 -0
- django_chile_cities-1.0.0/django_chile_cities/factories.py +26 -0
- django_chile_cities-1.0.0/django_chile_cities/fixtures/city.json +4154 -0
- django_chile_cities-1.0.0/django_chile_cities/fixtures/province.json +506 -0
- django_chile_cities-1.0.0/django_chile_cities/fixtures/region.json +146 -0
- django_chile_cities-1.0.0/django_chile_cities/management/__init__.py +0 -0
- django_chile_cities-1.0.0/django_chile_cities/management/commands/__init__.py +0 -0
- django_chile_cities-1.0.0/django_chile_cities/management/commands/load_chile_cities.py +17 -0
- django_chile_cities-1.0.0/django_chile_cities/migrations/0001_initial.py +45 -0
- django_chile_cities-1.0.0/django_chile_cities/migrations/__init__.py +0 -0
- django_chile_cities-1.0.0/django_chile_cities/models.py +27 -0
- django_chile_cities-1.0.0/django_chile_cities/tests.py +12 -0
- django_chile_cities-1.0.0/django_chile_cities/views.py +3 -0
- django_chile_cities-1.0.0/django_chile_cities.egg-info/PKG-INFO +81 -0
- django_chile_cities-1.0.0/django_chile_cities.egg-info/SOURCES.txt +34 -0
- django_chile_cities-1.0.0/django_chile_cities.egg-info/dependency_links.txt +1 -0
- django_chile_cities-1.0.0/django_chile_cities.egg-info/requires.txt +7 -0
- django_chile_cities-1.0.0/django_chile_cities.egg-info/top_level.txt +2 -0
- django_chile_cities-1.0.0/pyproject.toml +3 -0
- django_chile_cities-1.0.0/setup.cfg +49 -0
- django_chile_cities-1.0.0/setup.py +4 -0
- django_chile_cities-1.0.0/tests_project/__init__.py +0 -0
- django_chile_cities-1.0.0/tests_project/manage.py +22 -0
- django_chile_cities-1.0.0/tests_project/tests_project/__init__.py +0 -0
- django_chile_cities-1.0.0/tests_project/tests_project/asgi.py +16 -0
- django_chile_cities-1.0.0/tests_project/tests_project/settings.py +124 -0
- django_chile_cities-1.0.0/tests_project/tests_project/urls.py +22 -0
- django_chile_cities-1.0.0/tests_project/tests_project/wsgi.py +16 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024, Daniel Cristóbal Ojeda Sandoval
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
1. Redistributions of source code must retain the above copyright notice,
|
|
10
|
+
this list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
and/or other materials provided with the distribution.
|
|
15
|
+
|
|
16
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
17
|
+
contributors may be used to endorse or promote products derived from
|
|
18
|
+
this software without specific prior written permission.
|
|
19
|
+
|
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: django_chile_cities
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Una librería Django para manejar regiones, provincias y ciudades en Chile.
|
|
5
|
+
Home-page: https://github.com/NewDevCoop/django-chile-cities
|
|
6
|
+
Author: Daniel Ojeda
|
|
7
|
+
Author-email: danielo@newdev.cl
|
|
8
|
+
License: BSD-3-Clause
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Framework :: Django
|
|
11
|
+
Classifier: Framework :: Django :: 3.2
|
|
12
|
+
Classifier: Framework :: Django :: 4.0
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: BSD License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
22
|
+
Requires-Python: >=3.8
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Requires-Dist: django>=3.2
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: pytest; extra == "dev"
|
|
28
|
+
Requires-Dist: pytest-django; extra == "dev"
|
|
29
|
+
Requires-Dist: tox; extra == "dev"
|
|
30
|
+
Requires-Dist: coverage; extra == "dev"
|
|
31
|
+
|
|
32
|
+
# Chile Cities
|
|
33
|
+
|
|
34
|
+
**Chile Cities** is a Django app to load cities and regions of Chile.
|
|
35
|
+
|
|
36
|
+
Detailed documentation is in the `docs` directory.
|
|
37
|
+
|
|
38
|
+
## Quick Start
|
|
39
|
+
|
|
40
|
+
1. Add `chile-cities` to your `INSTALLED_APPS` setting like this:
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
INSTALLED_APPS = [
|
|
44
|
+
...,
|
|
45
|
+
"django_chile_cities",
|
|
46
|
+
]
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
2. Run the following command to create the `chile-cities` models:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
python manage.py migrate
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
3. Load the seed data by running:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
python manage.py load-chile-cities
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Usage
|
|
62
|
+
|
|
63
|
+
1. Import `django_chile_cities` models in your project:
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
from django_chile_cities.models import Region, Province, City
|
|
67
|
+
|
|
68
|
+
class MyTable(models.Model):
|
|
69
|
+
...
|
|
70
|
+
city = models.ForeignKey(City, on_delete=models.PROTECT)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
2. Access to province and region trough city instance:
|
|
74
|
+
|
|
75
|
+
```python
|
|
76
|
+
|
|
77
|
+
my_table_instance.city.province.region
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
And that's it, simple, but needed in multiple projects.
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Chile Cities
|
|
2
|
+
|
|
3
|
+
**Chile Cities** is a Django app to load cities and regions of Chile.
|
|
4
|
+
|
|
5
|
+
Detailed documentation is in the `docs` directory.
|
|
6
|
+
|
|
7
|
+
## Quick Start
|
|
8
|
+
|
|
9
|
+
1. Add `chile-cities` to your `INSTALLED_APPS` setting like this:
|
|
10
|
+
|
|
11
|
+
```python
|
|
12
|
+
INSTALLED_APPS = [
|
|
13
|
+
...,
|
|
14
|
+
"django_chile_cities",
|
|
15
|
+
]
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
2. Run the following command to create the `chile-cities` models:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
python manage.py migrate
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
3. Load the seed data by running:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
python manage.py load-chile-cities
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Usage
|
|
31
|
+
|
|
32
|
+
1. Import `django_chile_cities` models in your project:
|
|
33
|
+
|
|
34
|
+
```python
|
|
35
|
+
from django_chile_cities.models import Region, Province, City
|
|
36
|
+
|
|
37
|
+
class MyTable(models.Model):
|
|
38
|
+
...
|
|
39
|
+
city = models.ForeignKey(City, on_delete=models.PROTECT)
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
2. Access to province and region trough city instance:
|
|
43
|
+
|
|
44
|
+
```python
|
|
45
|
+
|
|
46
|
+
my_table_instance.city.province.region
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
And that's it, simple, but needed in multiple projects.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
Chile Cities
|
|
2
|
+
============
|
|
3
|
+
|
|
4
|
+
**Chile Cities** is a Django app to load cities and regions of Chile.
|
|
5
|
+
|
|
6
|
+
Detailed documentation is in the ``docs`` directory.
|
|
7
|
+
|
|
8
|
+
Quick Start
|
|
9
|
+
-----------
|
|
10
|
+
|
|
11
|
+
1. Add ``chile-cities`` to your ``INSTALLED_APPS`` setting like this:
|
|
12
|
+
|
|
13
|
+
.. code-block:: python
|
|
14
|
+
|
|
15
|
+
INSTALLED_APPS = [
|
|
16
|
+
...,
|
|
17
|
+
"django_chile_cities",
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
2. Run the following command to create the ``chile-cities`` models:
|
|
21
|
+
|
|
22
|
+
.. code-block:: bash
|
|
23
|
+
|
|
24
|
+
python manage.py migrate
|
|
25
|
+
|
|
26
|
+
3. Load the seed data by running:
|
|
27
|
+
|
|
28
|
+
.. code-block:: bash
|
|
29
|
+
|
|
30
|
+
python manage.py load-chile-cities
|
|
31
|
+
|
|
32
|
+
Usage
|
|
33
|
+
-----
|
|
34
|
+
|
|
35
|
+
1. Import ``django_chile_cities`` models in your project:
|
|
36
|
+
|
|
37
|
+
.. code-block:: python
|
|
38
|
+
|
|
39
|
+
from django_chile_cities.models import Region, Province, City
|
|
40
|
+
|
|
41
|
+
class MyTable(models.Model):
|
|
42
|
+
...
|
|
43
|
+
city = models.ForeignKey(City, on_delete=models.PROTECT)
|
|
44
|
+
|
|
45
|
+
2. Access province and region through city instance:
|
|
46
|
+
|
|
47
|
+
.. code-block:: python
|
|
48
|
+
|
|
49
|
+
my_table_instance.city.province.region
|
|
50
|
+
|
|
51
|
+
And that's it, simple, but needed in multiple projects.
|
|
File without changes
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
from factory.django import DjangoModelFactory
|
|
2
|
+
from factory import SubFactory
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class RegionFactory(DjangoModelFactory):
|
|
6
|
+
class Meta:
|
|
7
|
+
model = 'chile_cities.region'
|
|
8
|
+
|
|
9
|
+
name = 'region 1'
|
|
10
|
+
iso_3166_2_cl = 'CL'
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class ProvinceFactory(DjangoModelFactory):
|
|
14
|
+
class Meta:
|
|
15
|
+
model = 'chile_cities.province'
|
|
16
|
+
|
|
17
|
+
name = 'provincia 1'
|
|
18
|
+
region = SubFactory(RegionFactory)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class CityFactory(DjangoModelFactory):
|
|
22
|
+
class Meta:
|
|
23
|
+
model = 'chile_cities.city'
|
|
24
|
+
|
|
25
|
+
name = 'ciudad 1'
|
|
26
|
+
province = SubFactory(ProvinceFactory)
|