A django package on top of nepali python package which supports nepali date time, time conversion, etc on django projects.
django
nepali >= 1.0.0
pip install django-nepali
On settings.py
, add 'django_nepali'
to your INSTALLED_APPS
.
INSTALLED_APPS = [
...
'django_nepali',
...
]
In your Template
{% load nepalidatetime %}
nepalinow
renders the current Nepali date and time in 'en-US' locale (English).
{% nepalinow %}
{% nepalinow '%Y-%m-%d' %}
nepalinow_ne
renders the current Nepali date and time in 'ne' locale (Nepali).
{% nepalinow_ne %}
{% nepalinow_ne '%Y-%m-%d' %}
nepalidate
renders the datetime object into nepali datetime format in 'en-US' locale (English).
{{ datetime_obj|nepalidate }}
{{ datetime_obj|nepalidate:"%Y-%m-%d" }}
nepalidate_ne
renders the datetime object into nepali datetime format in 'ne' locale (Nepali).
{{ datetime_obj|nepalidate_ne }}
{{ datetime_obj|nepalidate_ne:"%Y-%m-%d" }}
nepalihumanize
renders the datetime object to a human readable form for 'ne' locale (Nepali)
{{ datetime_obj|nepalihumanize }}
You can provide a threshold input, measured in seconds, to the nepalihumanize
filter. If the time difference between the current time and the datetime_obj
is greater than the specified threshold, then instead of relative time as provided by the humanize function, the datetime_obj
will be displayed in the specified format (if provided), or else in the default format.
{{ datetime_obj|nepalihumanize:1000 }}
In your Template
{% load nepalinumber %}
nepalinumber
renders the english number into nepali format (devanagari)
{{ forloop.counter|nepalinumber }}
{{ 150|nepalinumber }}
Renders the given value with commas added in Nepali style without converting the number.
{{ number|nepali_comma }}
This would convert a number such as 100000
into 1,00,000
.
Renders the given value with commas added in English style without converting the number.
{{ number|english_comma }}
This would convert a number such as 100000
into 100,000
.
Converts the number into nepali number and renders it. Basically same as {{ number|nepalinumber|nepali_comma }}
{{ number|nepalinumber_with_comma }}
This would convert a number such as 1000
into १,०००
.
We appreciate feedback and contribution to this package. To get started please see our contribution guide