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)
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
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
django-jalali-date-3-0.2.1.tar.gz
(184.4 kB
view details)
File details
Details for the file django-jalali-date-3-0.2.1.tar.gz
.
File metadata
- Download URL: django-jalali-date-3-0.2.1.tar.gz
- Upload date:
- Size: 184.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55bff2b6570393bac0f64dff376008ae75b5e35d52b917c76b044687f838777b |
|
MD5 | 4c91b591b4387c03af3a07833b995921 |
|
BLAKE2b-256 | c14f4b9f32ef3c54b0feff4b4ab972423296fac3cc9226b079ffb37a5d785e5f |