Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Mirage-Tech-Cuba/django-l10n-cu
Django app for adapting a product for a cuban market, with Provinces and Municipalities.
https://github.com/Mirage-Tech-Cuba/django-l10n-cu
cuba django hacktoberfest l10n
Last synced: 4 months ago
JSON representation
Django app for adapting a product for a cuban market, with Provinces and Municipalities.
- Host: GitHub
- URL: https://github.com/Mirage-Tech-Cuba/django-l10n-cu
- Owner: Mirage-Tech-Cuba
- License: gpl-3.0
- Created: 2020-06-28T14:46:41.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-04-27T17:55:58.000Z (almost 3 years ago)
- Last Synced: 2024-07-31T20:46:08.822Z (7 months ago)
- Topics: cuba, django, hacktoberfest, l10n
- Language: Python
- Homepage: http://mirage-tech-cuba.github.io
- Size: 54.7 KB
- Stars: 8
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- Contributing: CONTRIBUTING
Awesome Lists containing this project
- cuban-opensource - django-l10n-cu
README
==================================
Cuban Localization (``l10n_cuba``)
==================================``l10n_cuba`` is a Django app for adapting a product for a cuban market, with Provinces, Municipalities and Zip Codes.
-------
Install
-------
``pip install django-l10n-cu``-----------
Quick start
-----------
1. Add ``"l10n_cuba"`` to your INSTALLED_APPS setting like thisINSTALLED_APPS = [
...,
'l10n_cuba',
``]``2. Run ``python manage.py migrate`` to create the ``l10n_cuba`` models.
3. You need to specify the ``L10N_CUBA_ADMIN`` variable in your settings file, and set it to ``True`` enable the admin for this app.
4. Start the development server and visit http://127.0.0.1:8000/admin/
to view the models populated (you'll need the Admin app enabled).-----
Usage
-----Get all Provinces
>>> from l10n_cuba.models import Provincia
>>> p = Provincia.objects.all()
, , , , , , , , , , , , , , , ]>Get all Municipalities in a Province
>>> from l10n_cuba.models import Provincia
>>> p = Provincia.objects.get(nombre_corto='MTZ')
>>> m = p.municipios.all()
, , , , , , , , , , , , ]>Ask if a Municipality is within a Province
>>> from l10n_cuba.models import Municipio, Provincia
>>> cardenas = Municipio.objects.get(nombre='Cárdenas')
>>> p_mtz = Provincia.objects.get(nombre_corto='MTZ')
>>> cardenas in p_mtz.municipios.all()
True--------
Features
--------
* Validators
>>> from l10n_cuba.validators import cubanCIValidator
>>> ci = models.CharField(max_length=11, validators=[cubanCIValidator])* Custom Fields
>>> from l10n_cuba.fields import GroupedModelChoiceField
>>> from l10n_cuba.models import Municipio
>>> location = GroupedModelChoiceField(queryset=Municipio.objects.all(), choices_groupby='provincia',)---------------
Future Features
---------------
* Small towns and other cities in municipalities.
* `urls.py` file.
* Django-Rest-Framework integration.
* Methods for comparisons.
* Map snippets for the whole country and provinces only. (help wanted)