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.

Filename, size & hash SHA256 hash help File type Python version Upload date
django-jalali-date-3-0.2.1.tar.gz (184.4 kB) Copy SHA256 hash SHA256 Source None Jun 1, 2017

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page