- Added caching for parsed fields and normalize_address to improve admin performance. - Fixed numerous bugs in date/time parsing, validation, and JS event handling.
2.4 KiB
2.4 KiB
Features TODO
Localization & Formatting
- Nepali Currency Formatter: Template tag for formatting money using the Nepali numbering system (Lakhs, Crores).
- Numbers to Words: Convert digits like
1234into Nepali text (एक हजार दुई सय चौंतीस). - Unicode Helpers: Built-in filters for converting common text/numbers into Nepali Unicode equivalent.
Integration
- Framework-agnostic API: Drop DRF / django-filter dependency; expose
django_nepkit.apihelpers usable from any view layer.
Address & Location
- Address Normalization: Implement a way to verify or suggest standardized Nepali addresses.
Validation & Robustness (audit, v0.2.2)
- Fix settings TOCTOU (
NepkitSettingsre-readssettings.NEPKITon every access). - Fix XSS in
_render_options. format_nepali_currencyend-to-endDecimal, raise on non-finite.number_to_nepali_wordshandles negatives; raises on non-numeric.BaseNepaliBSField.to_python/get_prep_valueraise on bad input._parse_language_paramsstrictmode + canonical-value whitelist._get_primary_paramonly falls back when there's a single non-internal param.- Narrow
except Exception: passinadmin.pyto(FieldDoesNotExist, AttributeError). - Log
NoReverseMatchin widgets (with hint to includedjango_nepkit.urls). strictflag on everydjango_nepkit.api.serialize_*/deserialize_*/to_decimal._looks_numericrejectsinf/nan/1e1000.- Demo API: validate
?order=,?year=,?month=,?amount_range=,?date_range=; return 400 on bad input. address-chaining.js: scope MutationObserver; suppress init-timechangeevents; log fetch errors.nepali-time-init.js: support Nepali-digit input; ship default CSS for.nepkit-time-invalid.- Rank location matches in
_find_location_in_tokens(exact > substring). - Catch
nepali.exceptions.FormatNotMatchExceptionin the parsers. NepaliTimeField.from_db_value(validate on read).NepkitSettings.__setattr__blocks accidental writes (read-only).
Still open / nice-to-haves
Nothing left — the perf and escaping improvements below are merged.
- Cache parsed
BaseNepaliBSFieldvalues per row in admin list views (perf). - Replace the
format_html_joinhelper in_render_optionswith a<template>-based renderer for better escaping control.