refactor: global project refinement, DRY consolidation, and documentation overhaul
This commit represents a comprehensive improvement of the library's architecture, developer experience, and documentation accuracy. Core Refactoring: - apply DRY principle to models.py by introducing BaseNepaliBSField and BaseLocationField - standardize widget logic in widgets.py using NepaliWidgetMixin - centralize admin filtering logic into BaseNepaliDateFilter New Features & API: - add NepaliMonthFilter for Django Admin and NepaliDateMonthFilter for DRF - implementation of HTMX-driven location chaining for dynamic address selects - extend demo project with comprehensive DRF search, ordering, and filter examples Configuration & Sync: - implement global NEPKIT settings in conf.py (DEFAULT_LANGUAGE, ADMIN_DATEPICKER, etc.) - universalize BS_DATE_FORMAT/BS_DATETIME_FORMAT across the entire stack - synchronize frontend datepicker initialization with backend date formats Documentation & DX: - complete rewrite of README.md into high-energy, factual, English-only guides - project-wide audit and simplification of comments/docstrings for beginner accessibility - expanded 'Technical Design' and 'FAQ' sections covering data integrity and storage - added docs/migration_guide.py for bulk AD-to-BS data transitions Quality & Maintenance: - fixed all E402 module-level import errors across the library - verified codebase with project-wide ruff checks (all checks passed)
This commit is contained in:
32 files changed
+3002
-531
No files matched your search
+34
-13
@@ -12,22 +12,43 @@ from django_nepkit import (
|
||||
|
||||
class Person(models.Model):
|
||||
name = models.CharField(max_length=100)
|
||||
# Date/time fields - now default to English via NEPKIT['DEFAULT_LANGUAGE']
|
||||
birth_date = NepaliDateField() # Defaults to en=True
|
||||
birth_date_ne = NepaliDateField(ne=True, blank=True, null=True) # Explicitly Nepali
|
||||
registration_time = NepaliTimeField(auto_now_add=True) # Defaults to en=True
|
||||
# Dates and times
|
||||
birth_date = NepaliDateField() # English by default
|
||||
birth_date_ne = NepaliDateField(ne=True, blank=True, null=True) # Using Devanagari
|
||||
registration_time = NepaliTimeField(auto_now_add=True) # English digits by default
|
||||
phone_number = NepaliPhoneNumberField()
|
||||
|
||||
# Address chaining - now default to English via NEPKIT['DEFAULT_LANGUAGE']
|
||||
province = ProvinceField() # Defaults to en=True
|
||||
province_ne = ProvinceField(ne=True, blank=True, null=True) # Explicitly Nepali
|
||||
district = DistrictField() # Defaults to en=True
|
||||
district_ne = DistrictField(ne=True, blank=True, null=True) # Explicitly Nepali
|
||||
municipality = MunicipalityField() # Defaults to en=True
|
||||
municipality_ne = MunicipalityField(ne=True, blank=True, null=True) # Explicitly Nepali
|
||||
# Location fields
|
||||
province = ProvinceField() # English names by default
|
||||
province_ne = ProvinceField(ne=True, blank=True, null=True) # In Devanagari
|
||||
district = DistrictField()
|
||||
district_ne = DistrictField(ne=True, blank=True, null=True)
|
||||
municipality = MunicipalityField()
|
||||
municipality_ne = MunicipalityField(ne=True, blank=True, null=True)
|
||||
|
||||
created_at = NepaliDateTimeField(auto_now_add=True) # Defaults to en=True
|
||||
updated_at = NepaliDateTimeField(auto_now=True) # Defaults to en=True
|
||||
created_at = NepaliDateTimeField(auto_now_add=True)
|
||||
updated_at = NepaliDateTimeField(auto_now=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class Citizen(models.Model):
|
||||
name = models.CharField(max_length=100)
|
||||
|
||||
# Chaining works automatically
|
||||
province = ProvinceField()
|
||||
district = DistrictField()
|
||||
municipality = MunicipalityField()
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
||||
|
||||
class AuditedPerson(models.Model):
|
||||
name = models.CharField(max_length=100)
|
||||
birth_date = NepaliDateField()
|
||||
created_at = NepaliDateTimeField(auto_now_add=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
Reference in new issue
Block a user