dz_locations
DZ Locations is a Django package that provides Algerian wilayas (states) and communes (municipalities) ready to use in your Django projects.
This package helps you quickly populate your database with all Algerian locations and access them via Django Admin or API.
Installation
Install the package via pip:
pip install dz-locations
Features
- ✅ Ready-to-use Wilayas & Communes of Algeria
- ✅ Arabic & French names
- ✅ Longitude & Latitude for mapping
- ✅ DRF serializers included
Usage
-
Add
dz_locationsto yourINSTALLED_APPSinsettings.py:INSTALLED_APPS = [ ... 'dz_locations', ]
-
Run migrations to create database tables
python manage.py makemigrations dz_locations python manage.py migrate
-
Include the app URLs in your root URLconf :
from django.urls import include, path urlpatterns = [ ..., path("dzloc", include("dz_locations.urls")), ]
-
(Optional) If you want to populate your database with the provided Algerian locations data,
run the following management command:python manage.py newload
-
Access the data:
- Via Django Admin (Wilayas & Communes models).
- Or via the provided serializers for API development (Django REST Framework).
Use Cases
Example usage with the included endpoints:
from django.urls import path
from .views import WilayaListAPI, get_wliaya
urlpatterns = [
path('wilayas/', WilayaListAPI.as_view(), name='wilaya-list'),
path('wilaya/<str:code>/', get_wliaya, name='get-wilaya-by-code'),
]
Example Requests
-
Get all Wilayas
GET /dzloc/wilayas/ -
Get a specific Wilaya by code
GET /dzloc/wilaya/01/
Example Response (for /dzloc/wilayas/01/)
{
"id": 1,
"code": "01",
"name": "Adrar",
"ar_name": "أدرار",
"longitude": 27.9766155,
"latitude": -0.20396,
"communes": [
{
"id": 1,
"post_code": "01001",
"name": "Adrar",
"ar_name": "أدرار",
"longitude": 27.9763317,
"latitude": -0.4841573
}
,
]
}
Data Source
The JSON data used in this project is sourced from:
👉 Wilaya-Of-Algeria by AbderrahmeneDZ
Contributing
Contributions are welcome! If you'd like to contribute, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Commit your changes and push them to your fork.
- Submit a pull request.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Metadata
Release files for dz-locations 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dz_locations-0.1.6.tar.gz | 59.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dz_locations-0.1.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 121.5 kB
Release files / dz_locations-0.1.6.tar.gz
| Download URL | dz_locations-0.1.6.tar.gz |
|---|---|
| Size | 59.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e83a0fc68f5955dbdcbfc02ef4cb7e1d61b9eda8c3e282f45c7d8d0e7f2e4e6a
|
|
BLAKE2b-256 checksum How to use checksums |
9d563b5e3ad1eed1133c9910db36d4cfaa3791c56761cb41a74167928b6353d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.11
|
Release files / dz_locations-0.1.6-py3-none-any.whl
| Download URL | dz_locations-0.1.6-py3-none-any.whl |
|---|---|
| Size | 62.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b933d8d54e66cdd8c02db69ffe61b2b80f1c5de3eab8f16faad1dfc03c306041
|
|
BLAKE2b-256 checksum How to use checksums |
40e40a197ab2d5bad863655a2752cbf9a1f4b3ee092d6aaa99af9e7565d42859
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.11
|