Django nepali datetime helpers.
Project description
Highly motivated package from Django’s DateField & DateTimeField.
Note: Currently only supports DateField. DateTimeField will be supported in future releases.
The package is dependent on nepali-datetime package & the UI for the date picker is forked from https://github.com/leapfrogtechnology/nepali-date-picker.
Installation
$ pip install django-nepali-datetime-field
Quick start
Add nepali-datetime-field to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [ ... 'nepali-datetime-field', ]
Import & use NepaliDateField to your model:
from nepali_datetime_field.models import NepaliDateField class YourModel(models.Model): ... nepali_date = NepaliDateField()
Using the field in your form:
from nepali_datetime_field.forms import NepaliDateField class YourForm(forms.Form): ... nepali_date = NepaliDateField()
Whenever using the field in html add the init script to load the date picker:
<html> {% load static %} ... <body> ... </body> {% static 'nepali_datetime_field/init.js' %} </html>
Querying the 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))
Demo
Demo of example_app deployed here.
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
Close
Hashes for django-nepali-datetime-field-0.4.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c31a604d206474463fa0e500711321f2c8539c2889a33aa22b24451708e4afc6 |
|
MD5 | 7e486e4b64c692490ea195734a10d1a8 |
|
BLAKE2b-256 | d0771ee63d2cf677fe4b068f7df90bdee1b531511f1f3551b062120096482bba |
Close
Hashes for django_nepali_datetime_field-0.4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2a8ee80933959a5be605c3dd0ae21afff212afbb7addd071b567be9adc0cfc48 |
|
MD5 | 3f09e505ca3d71f4090a6bb04d7c26d6 |
|
BLAKE2b-256 | 6809a3d9913210601d8f1a5c102e45762185fe3a93fd74dd40800ec5df367aa9 |