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.
This commit is contained in:
10 files changed
+295
-13
No files matched your search
@@ -231,12 +231,12 @@ class NepaliAdminMixin:
|
||||
|
||||
return format_nepali_datetime(datetime_value, format_string, ne=ne)
|
||||
|
||||
def format_nepali_currency(self, value, currency_symbol="Rs.", **kwargs):
|
||||
def format_nepali_currency(self, value, currency_symbol="Rs.", ne=False, **kwargs):
|
||||
"""
|
||||
Format a number with Nepali-style commas.
|
||||
Available as a method on admin classes using this mixin.
|
||||
"""
|
||||
return format_nepali_currency(value, currency_symbol=currency_symbol)
|
||||
return format_nepali_currency(value, currency_symbol=currency_symbol, ne=ne)
|
||||
|
||||
|
||||
class NepaliModelAdmin(NepaliAdminMixin, admin.ModelAdmin):
|
||||
|
||||
Reference in new issue
Block a user