feat(model): added administrative locations (provinces, districts, municipalities) field with full localization support

This commit is contained in:
sankalp committed 2026-01-28 23:51:29 +05:45
1 parent 1e3e3f58bc
commit 3cb7eccf24
6 files changed
+217

No files matched your search

+15
View File
@@ -0,0 +1,15 @@
from nepali.locations import districts, provices
def get_districts_by_province(provice_name):
selected_province = next((p for p in provices if p.name == provice_name), None)
if not selected_province:
return []
return [{"id": d.name, "text": d.name} for d in selected_province.districts]
def get_municipalities_by_district(district_name):
selected_district = next((d for d in districts if d.name == district_name), None)
if not selected_district:
return []
return [{"id": m.name, "text": m.name} for m in selected_district.municipalities]