# django-nepali
[![CI status](https://github.com/opensource-nepal/django-nepali/actions/workflows/python-package.yml/badge.svg?branch=main)](https://github.com/opensource-nepal/django-nepali/actions)
[![Downloads](https://img.shields.io/pypi/dm/django-nepali.svg?maxAge=180)](https://pypi.org/project/django-nepali/)
[![codecov](https://codecov.io/gh/opensource-nepal/django-nepali/branch/main/graph/badge.svg?token=PTUHYWCJ4I)](https://codecov.io/gh/opensource-nepal/django-nepali)
A django package on top of [nepali](https://github.com/opensource-nepal/py-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`.
```python
INSTALLED_APPS = [
...
'django_nepali',
...
]
```
## Django Templates
### nepalidatetime
In your Template
```python
{% load nepalidatetime %}
```
#### nepalinow
`nepalinow` renders the current Nepali date and time in 'en-US' locale (English).
##### For default date format
```python
{% nepalinow %}
```
##### For custom date format
```python
{% nepalinow '%Y-%m-%d' %}
```
#### nepalinow_ne
`nepalinow_ne` renders the current Nepali date and time in 'ne' locale (Nepali).
##### For default date format
```python
{% nepalinow_ne %}
```
##### For custom date format
``` python
{% nepalinow_ne '%Y-%m-%d' %}
```
#### nepalidate
`nepalidate` renders the datetime object into nepali datetime format in 'en-US' locale (English).
##### For default date format
``` python
{{ datetime_obj|nepalidate }}
```
##### For custom date format
```python
{{ 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
```python
{{ datetime_obj|nepalidate_ne }}
```
##### For custom date format
```python
{{ datetime_obj|nepalidate_ne:"%Y-%m-%d" }}
```
#### nepalihumanize
`nepalihumanize` renders the datetime object to a human readable form for 'ne' locale (Nepali)
```python
{{ 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.
```python
{{ datetime_obj|nepalihumanize:1000 }}
```
### nepalinumber
In your Template
```python
{% load nepalinumber %}
```
`nepalinumber` renders the english number into nepali format (devanagari)
```python
{{ forloop.counter|nepalinumber }}
```
```python
{{ 150|nepalinumber }}
```
##### nepali_comma
Renders the given value with commas added in Nepali style without converting the number.
```python
{{ 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.
```python
{{ 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 }}`
```python
{{ number|nepalinumber_with_comma }}
```
This would convert a number such as `1000` into `१,०००`.
Raw data
{
"_id": null,
"home_page": "https://github.com/opensource-nepal/django-nepali",
"name": "django-nepali",
"maintainer": "",
"docs_url": null,
"requires_python": "",
"maintainer_email": "",
"keywords": "django,nepali date conversion,convert date,nepali date time,python convert date,parse nepali date time",
"author": "opensource-nepal",
"author_email": "aj3sshh@gmail.com, sugatbajracharya49@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/ca/d6/e92be905b7358dbfbc46bc361c7b05767da9dee5074bca0f14fca187547a/django-nepali-0.1.0.tar.gz",
"platform": null,
"description": "# django-nepali\n\n[![CI status](https://github.com/opensource-nepal/django-nepali/actions/workflows/python-package.yml/badge.svg?branch=main)](https://github.com/opensource-nepal/django-nepali/actions)\n[![Downloads](https://img.shields.io/pypi/dm/django-nepali.svg?maxAge=180)](https://pypi.org/project/django-nepali/)\n[![codecov](https://codecov.io/gh/opensource-nepal/django-nepali/branch/main/graph/badge.svg?token=PTUHYWCJ4I)](https://codecov.io/gh/opensource-nepal/django-nepali)\n\nA django package on top of [nepali](https://github.com/opensource-nepal/py-nepali/) python package which supports nepali date time, time conversion, etc on django projects.\n\n## Requirements\n\n django\n nepali >= 1.0.0\n\n## Installation\n\n pip install django-nepali\n\nOn `settings.py`, add `'django_nepali'` to your `INSTALLED_APPS`.\n\n```python\nINSTALLED_APPS = [\n ...\n 'django_nepali',\n ...\n]\n```\n\n## Django Templates\n\n### nepalidatetime\n\nIn your Template\n\n```python\n{% load nepalidatetime %}\n```\n\n#### nepalinow\n\n`nepalinow` renders the current Nepali date and time in 'en-US' locale (English).\n\n##### For default date format\n\n```python\n{% nepalinow %}\n```\n\n##### For custom date format\n\n```python\n{% nepalinow '%Y-%m-%d' %}\n```\n\n#### nepalinow_ne\n\n`nepalinow_ne` renders the current Nepali date and time in 'ne' locale (Nepali).\n\n##### For default date format\n\n```python\n{% nepalinow_ne %}\n```\n\n##### For custom date format\n\n``` python\n{% nepalinow_ne '%Y-%m-%d' %}\n```\n\n#### nepalidate\n\n`nepalidate` renders the datetime object into nepali datetime format in 'en-US' locale (English).\n\n##### For default date format\n\n``` python\n{{ datetime_obj|nepalidate }}\n```\n\n##### For custom date format\n\n```python\n{{ datetime_obj|nepalidate:\"%Y-%m-%d\" }}\n```\n\n#### nepalidate_ne\n\n`nepalidate_ne` renders the datetime object into nepali datetime format in 'ne' locale (Nepali).\n\n##### For default date format\n\n```python\n{{ datetime_obj|nepalidate_ne }}\n```\n\n##### For custom date format\n\n```python\n{{ datetime_obj|nepalidate_ne:\"%Y-%m-%d\" }}\n```\n\n#### nepalihumanize\n\n`nepalihumanize` renders the datetime object to a human readable form for 'ne' locale (Nepali)\n\n```python\n{{ datetime_obj|nepalihumanize }}\n```\n\n##### Humanize threshold\n\nYou 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.\n\n```python\n{{ datetime_obj|nepalihumanize:1000 }}\n```\n\n### nepalinumber\n\nIn your Template\n\n```python\n{% load nepalinumber %}\n```\n\n`nepalinumber` renders the english number into nepali format (devanagari)\n\n```python\n{{ forloop.counter|nepalinumber }}\n```\n\n```python\n{{ 150|nepalinumber }}\n```\n\n##### nepali_comma\n\nRenders the given value with commas added in Nepali style without converting the number.\n\n```python\n{{ number|nepali_comma }}\n```\n\nThis would convert a number such as `100000` into `1,00,000`.\n\n##### english_comma\n\nRenders the given value with commas added in English style without converting the number.\n\n```python\n{{ number|english_comma }}\n```\n\nThis would convert a number such as `100000` into `100,000`.\n\n##### nepalinumber with comma\n\nConverts the number into nepali number and renders it. Basically same as `{{ number|nepalinumber|nepali_comma }}`\n\n```python\n{{ number|nepalinumber_with_comma }}\n```\n\nThis would convert a number such as `1000` into `\u0967,\u0966\u0966\u0966`.\n",
"bugtrack_url": null,
"license": "",
"summary": "A django package on top of 'nepali' a python package which supports nepali date time, time conversion, etc on django projects.",
"version": "0.1.0",
"project_urls": {
"Homepage": "https://github.com/opensource-nepal/django-nepali"
},
"split_keywords": [
"django",
"nepali date conversion",
"convert date",
"nepali date time",
"python convert date",
"parse nepali date time"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "364fe7e6d391e3fb504a59e5d4a55b1ea7b327f602aa618a482fad44b97b0d84",
"md5": "29802a45d3e7be713b426df261c378bc",
"sha256": "9a0e89a476d355e618da758f5ab43232d251bb90b7226369174695079a3d1b97"
},
"downloads": -1,
"filename": "django_nepali-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "29802a45d3e7be713b426df261c378bc",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 16706,
"upload_time": "2023-06-10T16:02:59",
"upload_time_iso_8601": "2023-06-10T16:02:59.706515Z",
"url": "https://files.pythonhosted.org/packages/36/4f/e7e6d391e3fb504a59e5d4a55b1ea7b327f602aa618a482fad44b97b0d84/django_nepali-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "cad6e92be905b7358dbfbc46bc361c7b05767da9dee5074bca0f14fca187547a",
"md5": "4408f5402a3e27218e2cc329c93774ea",
"sha256": "b7e40ba4da0e7ce3633a35d6e87ff224416a5705005b55007778d926b2c5c6e4"
},
"downloads": -1,
"filename": "django-nepali-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "4408f5402a3e27218e2cc329c93774ea",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 16096,
"upload_time": "2023-06-10T16:03:02",
"upload_time_iso_8601": "2023-06-10T16:03:02.017160Z",
"url": "https://files.pythonhosted.org/packages/ca/d6/e92be905b7358dbfbc46bc361c7b05767da9dee5074bca0f14fca187547a/django-nepali-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-06-10 16:03:02",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "opensource-nepal",
"github_project": "django-nepali",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"requirements": [],
"lcname": "django-nepali"
}