A comprehensive Django package providing complete database of Uzbekistan's Regions, Districts & Quarters with multi-language support including Latin, Cyrillic, and Russian versions.
Project description
🌍 Uzbekistan
A comprehensive Django package providing complete database of Uzbekistan's Regions, Districts & Quarters with multi-language support including Latin, Cyrillic, and Russian versions.
📊 Database Overview
- Regions: 14
- Regions/Cities: 205
- Towns/Districts: 2,183+
✨ Features
- Complete database of Uzbekistan's Regions, Districts & Quarters
- Multi-language support:
- Uzbek (Latin)
- Uzbek (Cyrillic)
- Russian
- English
- REST API endpoints
- Configurable model activation
- Built-in caching
- Django Admin integration
- JSON serialization methods on all models
🚀 Quick Start
Installation
pip install uzbekistan
Basic Setup
- Add to
INSTALLED_APPS:
INSTALLED_APPS = [
...
'uzbekistan',
]
- Configure in
settings.py:
UZBEKISTAN = {
'models': {
'region': True, # Enable Region model
'district': True, # Enable District model
'village': True, # Enable Village model
},
'views': {
'region': True, # Enable RegionListAPIView
'district': True, # Enable DistrictListAPIView
'village': True, # Enable VillageListAPIView
},
'cache': {
'enabled': True, # Enable caching
'timeout': 3600, # Cache timeout (1 hour)
'key_prefix': "uzbekistan" # Cache key prefix
},
"use_authentication": False # Disable authentication for API views (if needed)
}
- Add URLs:
urlpatterns = [
path('', include('uzbekistan.urls')),
]
- Run migrations:
python manage.py makemigrations
python manage.py migrate
- Load data:
python manage.py loaddata regions
python manage.py loaddata districts
🔌 API Endpoints
Available Endpoints
| Endpoint | URL Pattern | Name | Description |
|---|---|---|---|
| Regions | /regions |
region-list |
List all regions |
| Districts | /districts/<int:region_id> |
district-list |
List districts for a specific region |
| Villages | /villages/<int:district_id> |
village-list |
List villages for a specific district |
Example Usage
# Get all regions
GET /regions
# Get districts for a specific region
GET /districts/1 # where 1 is the region_id
# Get villages for a specific district
GET /villages/1 # where 1 is the district_id
📋 JSON Serialization
All models provide an as_json() method for lightweight JSON-serializable output — useful outside of DRF views (e.g., management commands, Celery tasks, webhooks).
Region
region = Region.objects.get(pk=1)
region.as_json()
# {"id": 1, "name_uz": "Toshkent", "name_oz": "Тошкент", "name_ru": "Ташкент", "name_en": "Tashkent"}
District
district = District.objects.get(pk=1)
# Basic usage
district.as_json()
# {"id": 1, "name_uz": "Bekobod", "name_oz": "Бекобод", "name_ru": "Бекабад", "name_en": "Bekabad"}
# Include parent region
district.as_json(include_region=True)
# {"id": 1, "name_uz": "Bekobod", ..., "region": {"id": 1, "name_uz": "Toshkent", ...}}
Village
village = Village.objects.get(pk=1)
# Basic usage
village.as_json()
# {"id": 1, "name_uz": "Olmazar", "name_oz": "Олмазар", "name_ru": "Олмазар"}
# Include parent district
village.as_json(include_district=True)
# {"id": 1, ..., "district": {"id": 1, "name_uz": "Bekobod", ...}}
# Include both district and region
village.as_json(include_district=True, include_region=True)
# {"id": 1, ..., "district": {"id": 1, ..., "region": {"id": 1, ...}}}
🛠️ Development
Setup
# Clone repository
git clone https://github.com/ganiyevuz/uzbekistan.git
cd uzbekistan
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
# Install dependencies
pip install -e ".[dev]"
Development Tools
- Testing:
pytest - Code Style:
black --check uzbekistan/
📦 Release Process
Automated Release
- Update version:
python scripts/update_version.py 2.7.3
- Create and push tag:
git tag v2.7.3
git push origin v2.7.3
GitHub Actions will automatically:
- Run tests
- Build package
- Publish to PyPI
Manual Release
# Build package
python -m build
# Check package
twine check dist/*
# Upload to PyPI
twine upload dist/*
🤝 Contributing
- Fork the repository
- Create feature branch (
git checkout -b feature/amazing-feature) - Commit changes (
git commit -m 'Add amazing feature') - Push to branch (
git push origin feature/amazing-feature) - Open Pull Request
📄 License
This project is licensed under the MIT License - see LICENSE for details.
👤 Author
Jakhongir Ganiev - @ganiyevuz
🙏 Acknowledgments
- All contributors who helped improve this package
- Django and DRF communities for their excellent tools and documentation
Project details
Release history Release notifications | RSS feed
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file uzbekistan-2.8.4.tar.gz.
File metadata
- Download URL: uzbekistan-2.8.4.tar.gz
- Upload date:
- Size: 23.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5737f44f901716694dc1f614ca6e180501774acacf1624f0f428ba14a0b5387f
|
|
| MD5 |
886ae93c801ff00c6a8e9230878b6c44
|
|
| BLAKE2b-256 |
ee2fe5c6f41d510ff68b6f26d79d1a17e6f4664c98a077393efeba401d7ee65a
|
File details
Details for the file uzbekistan-2.8.4-py3-none-any.whl.
File metadata
- Download URL: uzbekistan-2.8.4-py3-none-any.whl
- Upload date:
- Size: 28.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc7c35c7b03c702e91baeb193ab5690f7ad8a3f6c9b33dbb9b0e18a62b32172b
|
|
| MD5 |
03830738d3f1172830307a8686c1cbc6
|
|
| BLAKE2b-256 |
7aca30b7048f2cefe96aef9c7f83ef9eeff2b1bf49c2a9d41937af43abd96457
|