A django package on top of 'nepali' a python package which supports nepali date time, time conversion, etc on django projects.
Project description
django-nepali
A django package on top of nepali python package which supports nepali date time, time conversion, etc on django projects.
Requirements
django
nepali >= 1.0.0
Installation
pip install django-nepali
On settings.py, add 'django_nepali' to your INSTALLED_APPS.
INSTALLED_APPS = [
...
'django_nepali',
...
]
Django Templates
nepalidatetime
In your Template
{% load nepalidatetime %}
nepalinow
nepalinow renders the current Nepali date and time in 'en-US' locale (English).
For default date format
{% nepalinow %}
For custom date format
{% nepalinow '%Y-%m-%d' %}
nepalinow_ne
nepalinow_ne renders the current Nepali date and time in 'ne' locale (Nepali).
For default date format
{% nepalinow_ne %}
For custom date format
{% nepalinow_ne '%Y-%m-%d' %}
nepalidate
nepalidate renders the datetime object into nepali datetime format in 'en-US' locale (English).
For default date format
{{ datetime_obj|nepalidate }}
For custom date format
{{ datetime_obj|nepalidate:"%Y-%m-%d" }}
nepalidate_ne
nepalidate_ne renders the datetime object into nepali datetime format in 'ne' locale (Nepali).
For default date format
{{ datetime_obj|nepalidate_ne }}
For custom date format
{{ datetime_obj|nepalidate_ne:"%Y-%m-%d" }}
nepalihumanize
nepalihumanize renders the datetime object to a human readable form for 'ne' locale (Nepali)
{{ datetime_obj|nepalihumanize }}
Humanize threshold
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 }}
nepalinumber
In your Template
{% load nepalinumber %}
nepalinumber renders the english number into nepali format (devanagari)
{{ forloop.counter|nepalinumber }}
{{ 150|nepalinumber }}
nepali_comma
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.
english_comma
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.
nepalinumber with comma
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 १,०००.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django-nepali-0.1.0.tar.gz.
File metadata
- Download URL: django-nepali-0.1.0.tar.gz
- Upload date:
- Size: 16.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7e40ba4da0e7ce3633a35d6e87ff224416a5705005b55007778d926b2c5c6e4
|
|
| MD5 |
4408f5402a3e27218e2cc329c93774ea
|
|
| BLAKE2b-256 |
cad6e92be905b7358dbfbc46bc361c7b05767da9dee5074bca0f14fca187547a
|
File details
Details for the file django_nepali-0.1.0-py3-none-any.whl.
File metadata
- Download URL: django_nepali-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a0e89a476d355e618da758f5ab43232d251bb90b7226369174695079a3d1b97
|
|
| MD5 |
29802a45d3e7be713b426df261c378bc
|
|
| BLAKE2b-256 |
364fe7e6d391e3fb504a59e5d4a55b1ea7b327f602aa618a482fad44b97b0d84
|