Skip to main content

Jalali Date support for user interface. Easy conversion of DateTimeFiled to JalaliDateTimeField within the admin site.

Project description

# django-jalali-date
Jalali Date support for user interface. Easy conversion of DateTimeFiled to JalaliDateTimeField within the admin site, view and templates.

----------
**DEPENDENCY**

To use this module you need to install jdatetime(and of course you need django) and pytz module which you can install it with easy_install or pip

----------
**INSTALL**

pip install django-jalali-date

----------
**USAGE**

settings.py

INSTALLED_APPS = [
...
'jalali_date',
...
]


python_file.py
```python
from jalali_date import datetime2jalali, date2jalali

def my_view(request):
jalali_join = datetime2jalali(request.user.date_joined).strftime('%y/%m/%d _ %H:%M:%S')
```

template.html
```html
{% load jalali_tags %}

<p>{{ request.user.date_joined|to_jalali:'%y/%m/%d _ %H:%M:%S' }}</p>
```

admin.py
```python
from django.contrib import admin
from jalali_date.admin import ModelAdminJalaliMixin, StackedInlineJalaliMixin, TabularInlineJalaliMixin

class MyInlines1(TabularInlineJalaliMixin, admin.TabularInline):
model = SecendModel

class MyInlines2(StackedInlineJalaliMixin, admin.StackedInline):
model = ThirdModel

@admin.register(FirstModel)
class FirstModelAdmin(ModelAdminJalaliMixin, admin.ModelAdmin):
inlines = (MyInlines1, MyInlines2, )
```

![example](http://bayanbox.ir/view/2877111068605695571/Screenshot-from-2016-07-26-01-37-07.png)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-jalali-date-3-0.2.1.tar.gz (184.4 kB view details)

Uploaded Source

File details

Details for the file django-jalali-date-3-0.2.1.tar.gz.

File metadata

File hashes

Hashes for django-jalali-date-3-0.2.1.tar.gz
Algorithm Hash digest
SHA256 55bff2b6570393bac0f64dff376008ae75b5e35d52b917c76b044687f838777b
MD5 4c91b591b4387c03af3a07833b995921
BLAKE2b-256 c14f4b9f32ef3c54b0feff4b4ab972423296fac3cc9226b079ffb37a5d785e5f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page