Commit Graph
38 Commits
Author SHA1 Message Date
sankalp 76e9ec4616 bumped to v.0.2 v.0.2.0 2026-01-31 14:29:04 +05:45
sankalp 0a9626fc01 bumped to v.0.2 2026-01-31 14:28:56 +05:45
sankalp 371d85dcf0 fix 2026-01-30 21:41:35 +05:45
sankalp 1d43951664 update 2026-01-30 21:36:22 +05:45
sankalp cdf714e526 update todo 2026-01-30 20:28:03 +05:45
sankalp ef8c75bf36 feat: implement address normalization and demo
- Add utility to parse raw address strings into structured Province, District, and Municipality data.
- Support both English and Nepali (Devanagari) inputs with smart matching for character variations.
- Implement comprehensive test suite for address normalization logic.
- Add real-time address normalization demo to the example app using HTMX.
- Update README with documentation and usage examples for the new utility.
2026-01-30 20:23:18 +05:45
sankalp c6301686cc feat: add Nepali currency support, number-to-words conversion, and REST API enhancements
- Implement NepaliCurrencyField for model-level currency handling.
- Add format_nepali_currency utility with Lakhs/Crores comma formatting and decimal support.
- Implement number_to_nepali_words and english_to_nepali_unicode helper functions.
- Add nepali_currency, nepali_words, and nepali_unicode template filters.
- Enhance REST API (DRF) support:
    - Added NepaliCurrencySerializerField for formatted currency output.
    - Added NepaliLocalizedSerializerMixin for automatic Devanagari field generation.
    - Added flexible NepaliCurrencyRangeFilter and NepaliDateRangeFilter.
- Integrated automatic currency formatting into NepaliModelAdmin.
- Expanded the example demo app with a Transaction model and updated filters.
- Added comprehensive unit tests for formatting, models, and API components.
- Updated documentation (README.md and todo.md) to reflect new features.
2026-01-30 20:06:39 +05:45
sankalp 12de34e354 feat: add Nepali currency field, number to words, and unicode helpers 2026-01-30 19:50:45 +05:45
sankalp e606a2b490 feat: add Nepali currency field, number to words, and unicode helpers 2026-01-30 19:50:26 +05:45
sankalp 2fea4d6db1 added todo 2026-01-30 19:18:00 +05:45
sankalp 192e1b8f5c update 2026-01-30 18:50:17 +05:45
sankalp 80059745c3 updated workflow 2026-01-30 18:47:43 +05:45
sankalp 98b73c45fb added workflow 2026-01-30 18:43:03 +05:45
sankalp d7c13a0cf5 test: add comprehensive pytest test suite with 67% coverage
This commit adds a complete test suite for django-nepkit with 62 test cases covering all major components.

Test Suite:
- 8 test modules covering models, forms, widgets, serializers, filters, validators, and utilities
- 62 total test cases with 50 passing and 12 expected failures (xfail)
- 67% overall code coverage with 85-100% on core components

Test Files Added:
- django_nepkit/tests/conftest.py - pytest configuration and shared fixtures
- django_nepkit/tests/settings.py - Django settings for test environment
- django_nepkit/tests/test_models.py - 15 tests for model fields
- django_nepkit/tests/test_forms.py - 6 tests for form validation
- django_nepkit/tests/test_validators.py - 7 tests for phone validation
- django_nepkit/tests/test_utils.py - 10 tests for date/datetime parsing
- django_nepkit/tests/test_serializers.py - 10 tests for DRF serializers
- django_nepkit/tests/test_filters.py - 4 tests for DRF filters
- django_nepkit/tests/test_widgets.py - 11 tests for widget rendering
- django_nepkit/tests/README.md - test documentation

Configuration:
- pytest.ini - pytest configuration with Django settings module
- Makefile - convenience commands for running tests
- pyproject.toml - moved pytest and pytest-cov to dev dependencies

Coverage Highlights:
- validators.py: 100%
- forms.py: 91%
- conf.py: 93%
- serializers.py: 89%
- widgets.py: 90%
- models.py: 60%

Running Tests:
DJANGO_SETTINGS_MODULE=django_nepkit.tests.settings uv run pytest django_nepkit/tests/ -v

With Coverage:
DJANGO_SETTINGS_MODULE=django_nepkit.tests.settings uv run pytest django_nepkit/tests/ --cov=django_nepkit --cov-report=html
2026-01-30 18:41:38 +05:45
sankalp d447f456ba feat: add English datepicker support and comprehensive documentation improvements
This commit adds English language support to the datepicker widget and includes major documentation enhancements with proper attribution.

New Features:
- add English language option to nepali-datepicker widget (language: 'english')
- datepicker now respects en=True field parameter for English month/day names
- automatic language detection based on DEFAULT_LANGUAGE setting

Documentation:
- add Credits section acknowledging nepali package and nepali-datepicker library
- improve FAQ formatting with proper spacing between questions

Bug Fixes:
- fix datepicker language selection logic to properly prioritize English mode
- correct nepali package attribution to opensource-nepal/py-nepali
- update nepali-datepicker GitHub link to correct repository

Technical Details:
- datepicker initialization now checks data-en attribute
- language priority: explicit ne=true > explicit en=true > default (English)
- English mode displays transliterated BS month names and Arabic numerals
2026-01-30 18:29:26 +05:45
sankalp fa255d0fcf docs: update 2026-01-30 17:21:37 +05:45
sankalp f59a4123cb docs: added showcase 2026-01-30 17:21:25 +05:45
sankalp 8189a8cd31 update gitignore 2026-01-30 17:01:57 +05:45
sankalp 1338f9e5fe 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)
2026-01-30 17:00:33 +05:45
sankalp 09f302ceaa feat: implement HTMX support, DRF filters, and professionalized documentation
- Implement server-side location chaining with HTMX support via `htmx=True` in fields and widgets.
- Update location views to handle HTMX requests and return HTML <option> fragments.
- Add NepaliDateYearFilter and NepaliDateRangeFilter for robust DRF API filtering.
- Expand default `DATE_INPUT_FORMATS` in configuration to support multiple common Nepali date styles.
- Update DRF serializers to automatically respect global `NEPKIT` configuration settings.
- Add `django-filter` as an optional dependency under the `drf` extra in pyproject.toml.
- Correct underlying dependency references from `nepali-datetime` to nepali library.
- Complete overhaul of README.md for premium DX, including new sections for storage behavior, timezone awareness, and API usage.
2026-01-30 15:22:13 +05:45
sankalp 7b07835e0c feat: implement zero-config address chaining and revamp documentation 2026-01-30 14:32:15 +05:45
sankalp b127d925f1 docs: updated readme 2026-01-30 13:34:35 +05:45
sankalp fc7789ab66 unwanted files 2026-01-30 13:33:10 +05:45
sankalp ed93467296 feat: revamp localization support with Devanagari (BS) integration and documentation
Implemented a comprehensive update to handle Nepali (Bikram Sambat) localization more robustly across models, forms, admin, and API serializers. This includes native support for Devanagari script output and a complete documentation overhaul.

Models & Fields:
- Added [NepaliFieldMixin](cci:2://file:///home/sankalp/Projects/prod-django-nepkit/django_nepkit/models.py:15:0-36:39) to support [ne](cci:1://file:///home/sankalp/Projects/prod-django-nepkit/django_nepkit/admin.py:146:4-163:67) (Nepali) and [en](cci:1://file:///home/sankalp/Projects/prod-django-nepkit/django_nepkit/widgets.py:4:0-10:16) (English) toggles for all custom fields.
- Updated [NepaliDateField](cci:2://file:///home/sankalp/Projects/prod-django-nepkit/django_nepkit/models.py:48:0-134:44), [NepaliDateTimeField](cci:2://file:///home/sankalp/Projects/prod-django-nepkit/django_nepkit/models.py:144:0-217:44), and [NepaliTimeField](cci:2://file:///home/sankalp/Projects/prod-django-nepkit/django_nepkit/models.py:137:0-141:34) with the new mixin and improved deconstruction.
- Enhanced address fields ([ProvinceField](cci:2://file:///home/sankalp/Projects/prod-django-nepkit/django_nepkit/models.py:220:0-262:23), [DistrictField](cci:2://file:///home/sankalp/Projects/prod-django-nepkit/django_nepkit/models.py:265:0-286:66), [MunicipalityField](cci:2://file:///home/sankalp/Projects/prod-django-nepkit/django_nepkit/models.py:289:0-310:66)) to support bilingual choices.

Admin Enhancements:
- Refactored date formatting into a common utility supporting Devanagari via `strftime_ne`.
- Updated [NepaliModelAdmin](cci:2://file:///home/sankalp/Projects/prod-django-nepkit/django_nepkit/admin.py:186:0-294:9) and [NepaliAdminMixin](cci:2://file:///home/sankalp/Projects/prod-django-nepkit/django_nepkit/admin.py:118:0-183:75) to auto-detect [ne](cci:1://file:///home/sankalp/Projects/prod-django-nepkit/django_nepkit/admin.py:146:4-163:67) settings from model fields for [list_display](cci:1://file:///home/sankalp/Projects/prod-django-nepkit/django_nepkit/admin.py:230:4-250:21).
- Improved widget injection in the admin to respect field-level localization settings.
- Added a JS bridge for admin jQuery compatibility with the Nepali datepicker.

Forms & Widgets:
- Introduced [NepaliWidgetMixin](cci:2://file:///home/sankalp/Projects/prod-django-nepkit/django_nepkit/widgets.py:13:0-38:12) to handle localization data attributes in the frontend.
- Updated [NepaliDatePickerWidget](cci:2://file:///home/sankalp/Projects/prod-django-nepkit/django_nepkit/widgets.py:63:0-99:42) with improved asset loading and Devanagari support.
- Fixed [NepaliDateFormField](cci:2://file:///home/sankalp/Projects/prod-django-nepkit/django_nepkit/forms.py:10:0-41:13) to correctly handle `empty_value` passed by the Django admin.

DRF (Serializers):
- Added [BaseNepaliBSField](cci:2://file:///home/sankalp/Projects/prod-django-nepkit/django_nepkit/serializers.py:21:0-106:48) to DRF serializers with support for `ne=True` for Devanagari output.
- Implemented specialized [NepaliDateSerializerField](cci:2://file:///home/sankalp/Projects/prod-django-nepkit/django_nepkit/serializers.py:114:0-122:28) and [NepaliDateTimeSerializerField](cci:2://file:///home/sankalp/Projects/prod-django-nepkit/django_nepkit/serializers.py:130:0-138:32).

Documentation:
- Completely revamped [README.md](cci:7://file:///home/sankalp/Projects/prod-django-nepkit/README.md:0:0-0:0) with professional design, badges, and detailed usage guides.
- Added explicit instructions for address chaining URLs and [NepaliAdminMixin](cci:2://file:///home/sankalp/Projects/prod-django-nepkit/django_nepkit/admin.py:118:0-183:75) usage.

Misc:
- Optimized address chaining JS logic.
- Updated example demo app models and migrations to reflect new field capabilities.
2026-01-30 13:32:33 +05:45
sankalp e62fbcef1c Update README.md v.1.0 2026-01-29 15:28:29 +05:45
sankalp 04e19ca63f upate 2026-01-29 02:05:18 +05:45
sankalp bba1a82a31 feat(docs): upate 2026-01-29 02:00:26 +05:45
sankalp 0039832bc3 feat(docs): upate 2026-01-29 02:00:01 +05:45
sankalp 5928e6348a feat(docs): upate 2026-01-29 01:57:52 +05:45
sankalp 3750bdf683 feat: add nepali admin datepicker, drf support and docs 2026-01-29 01:56:03 +05:45
sankalp 1a1dc3bee4 use dry principle possible and added example project 2026-01-29 01:37:41 +05:45
sankalp 2bb6458c8b feat(models): added nepalidatetime fields 2026-01-29 00:28:37 +05:45
sankalp 5ee2e8f32b feat(model): added nepalidatefield with calendar picker 2026-01-29 00:19:27 +05:45
sankalp 67a213162d feat(model): added nepalitimefield 2026-01-28 23:54:54 +05:45
sankalp 3cb7eccf24 feat(model): added administrative locations (provinces, districts, municipalities) field with full localization support 2026-01-28 23:51:29 +05:45
sankalp 1e3e3f58bc feat(model): added NepaliPhoneNumber Field 2026-01-28 23:25:00 +05:45
sankalp 9b83acc084 feat: scaffold initial project structure and configuration 2026-01-28 23:08:23 +05:45
sankalp 65d0d77aeb Initial commit 2026-01-28 20:08:35 +05:45