=====================
Nepali DateTime Field
=====================
Highly motivated package from Django's DateField & DateTimeField. The library is intended to provide
Bikram Sambat Date Time fields for Django's Model and Form.
:code:`Note: Currently only supports DateField. DateTimeField will be supported soon in future releases.`
The package is dependent on `nepali-datetime <https://github.com/dxillar/nepali-datetime>`_ package and the UI for the date picker is implemented from https://github.com/leapfrogtechnology/nepali-date-picker.
**Supports: Django 2.0+**
Installation
------------
::
$ pip install django-nepali-datetime-field
Quick start
-----------
1. Add ``nepali_datetime_field`` to your ``INSTALLED_APPS`` list::
INSTALLED_APPS = [
...
'nepali_datetime_field',
]
2. Importing ``NepaliDateField`` model field to ``models.py`` file::
from nepali_datetime_field.models import NepaliDateField
class YourModel(models.Model):
...
nepali_date = NepaliDateField()
3. Importing ``NepaliDateField`` form field to ``forms.py`` file::
from nepali_datetime_field.forms import NepaliDateField
class YourForm(forms.Form):
...
nepali_date = NepaliDateField()
4. Whenever using ``NepaliDateField`` form field, don't forget to add Widget's media on the `<head>` section of the html as below::
<html>
<head>
...
{{ form.media }}
...
</head>
<body>
...
{{ form }}
...
</body>
</html>
5. Querying the model field::
import nepali_datetime
nepali_date = nepali_datetime.date(1995,10,1)
# get query
YourModel.objects.get(nepali_date=nepali_date)
# filter query
YourModel.objects.filter(nepali_date=nepali_date)
# date range query
from_date = nepali_datetime.date(1990,1,1)
to_date = nepali_datetime.date(1999,12,30)
YourModel.objects.filter(nepali_date__range=(from_date, to_date))
More Usage
----------
Check some of the usage details in `example_app/tests.py <https://github.com/dxillar/django-nepali-datetime-field/blob/main/example_app/tests.py>`__.
Demo
----
Play around with the live demo `here <https://nepali-datetime-field.herokuapp.com/example/create>`__.
Raw data
{
"_id": null,
"home_page": "https://github.com/dxillar/django-nepali-datetime-field",
"name": "django-nepali-datetime-field",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": null,
"author": "Amit Garu <amitgaru2@gmail.com>",
"author_email": "amitgaru2@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/5f/d1/775dcb09c358f1238196876771696be40222dd9b7cce111fbc7d74ce21a3/django_nepali_datetime_field-0.7.1.tar.gz",
"platform": null,
"description": "=====================\nNepali DateTime Field\n=====================\n\nHighly motivated package from Django's DateField & DateTimeField. The library is intended to provide\nBikram Sambat Date Time fields for Django's Model and Form.\n\n:code:`Note: Currently only supports DateField. DateTimeField will be supported soon in future releases.`\n\nThe package is dependent on `nepali-datetime <https://github.com/dxillar/nepali-datetime>`_ package and the UI for the date picker is implemented from https://github.com/leapfrogtechnology/nepali-date-picker.\n\n**Supports: Django 2.0+**\n\nInstallation\n------------\n::\n\n $ pip install django-nepali-datetime-field\n\n\nQuick start\n-----------\n\n1. Add ``nepali_datetime_field`` to your ``INSTALLED_APPS`` list::\n\n INSTALLED_APPS = [\n ...\n 'nepali_datetime_field',\n ]\n\n2. Importing ``NepaliDateField`` model field to ``models.py`` file::\n\n from nepali_datetime_field.models import NepaliDateField\n\n class YourModel(models.Model):\n ...\n nepali_date = NepaliDateField()\n\n3. Importing ``NepaliDateField`` form field to ``forms.py`` file::\n \n from nepali_datetime_field.forms import NepaliDateField\n\n class YourForm(forms.Form):\n ...\n nepali_date = NepaliDateField()\n\n4. Whenever using ``NepaliDateField`` form field, don't forget to add Widget's media on the `<head>` section of the html as below::\n \n <html>\n <head>\n ...\n {{ form.media }}\n ...\n </head>\n <body>\n ...\n {{ form }}\n ...\n </body>\n </html>\n\n5. Querying the model field::\n \n import nepali_datetime\n\n nepali_date = nepali_datetime.date(1995,10,1)\n\n # get query\n YourModel.objects.get(nepali_date=nepali_date)\n\n # filter query\n YourModel.objects.filter(nepali_date=nepali_date)\n\n # date range query\n from_date = nepali_datetime.date(1990,1,1)\n to_date = nepali_datetime.date(1999,12,30)\n YourModel.objects.filter(nepali_date__range=(from_date, to_date))\n\n\nMore Usage\n----------\nCheck some of the usage details in `example_app/tests.py <https://github.com/dxillar/django-nepali-datetime-field/blob/main/example_app/tests.py>`__.\n\n\nDemo\n----\nPlay around with the live demo `here <https://nepali-datetime-field.herokuapp.com/example/create>`__.\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Django nepali datetime fields and helpers.",
"version": "0.7.1",
"project_urls": {
"Homepage": "https://github.com/dxillar/django-nepali-datetime-field"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c03ac26156b7999dff8466d27d927c981941c5258acbfd52d7b5807a9de12818",
"md5": "8633a640f48ae582de93d311718c7903",
"sha256": "9ee7706d9de186cbcc6d8ff69733c35b8c4439d5d1bab99d09dc0bf886249caf"
},
"downloads": -1,
"filename": "django_nepali_datetime_field-0.7.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8633a640f48ae582de93d311718c7903",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 7641,
"upload_time": "2024-05-21T19:26:41",
"upload_time_iso_8601": "2024-05-21T19:26:41.116705Z",
"url": "https://files.pythonhosted.org/packages/c0/3a/c26156b7999dff8466d27d927c981941c5258acbfd52d7b5807a9de12818/django_nepali_datetime_field-0.7.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5fd1775dcb09c358f1238196876771696be40222dd9b7cce111fbc7d74ce21a3",
"md5": "517b441e71a180693447bc2cdc2060a4",
"sha256": "e9790bae8c0d183612379bc8d572c5ced069926ab7b99ee51a788540f3deb216"
},
"downloads": -1,
"filename": "django_nepali_datetime_field-0.7.1.tar.gz",
"has_sig": false,
"md5_digest": "517b441e71a180693447bc2cdc2060a4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 5553,
"upload_time": "2024-05-21T19:26:42",
"upload_time_iso_8601": "2024-05-21T19:26:42.656093Z",
"url": "https://files.pythonhosted.org/packages/5f/d1/775dcb09c358f1238196876771696be40222dd9b7cce111fbc7d74ce21a3/django_nepali_datetime_field-0.7.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-21 19:26:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "dxillar",
"github_project": "django-nepali-datetime-field",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "django-nepali-datetime-field"
}