The django-iranian-cities is a valuable package based on Django Web Framework for Iranian cities support. You can see full documentation here readthedocs.
- Language: Python > 3.6
- Framework: Django > 3.2
First you have to install package using pip:
$ pip install django-iranian-cities
Then you should add iranian_cities
to INSTALLED_APPS:
INSTALLED_APPS = [
...
'iranian_cities',
...
]
Now you can migrate to apply model changes:
$ python manage.py migrate
For generating all data you can run this command:
$ python manage.py generate_city
NOTE: you should run this command once (if you want to run again flush db or delete all objects in iranian_cities app)
You can use field like this:
from django.db import models
from iranian_cities.fields import ProvinceField
class TestModel(models.Model):
province = ProvinceField()
list of fields:
- ProvinceField
- CountyField
- DistrictField
- CityField
- RuralDistrictField
- VillageField
## Admin
You can also use admin mixin class:
```python
from django.contrib import admin
from iranian_cities.admin import IranianCitiesAdmin
from test_app.models import TestModel
@admin.register(TestModel)
class TestModelAdmin(IranianCitiesAdmin):
pass
S.A.G.E. team Git Rules Policy is available here:
Sepehr Akbarazadeh Maintainer | Mehran Rahmanzadeh Maintainer |