Django Jalali Date

screenshot of Django Jalali Date

Django Jalali Date

Jalali Date support for user interface. Easy conversion of DateTimeFiled to JalaliDateTimeField within the admin site, views, forms and templates.

Overview:

This product is a Django module that adds support for the Jalali date system in the user interface. It allows for easy conversion of DateTimeFields to JalaliDateTimeFields within the admin site, view, and templates. To use this module, you need to have Django and the jdatetime and pytz modules installed.

Features:

  • Jalali Date Support: Adds support for displaying and manipulating Jalali dates in the Django user interface.
  • Conversion of DateTimeFields: Allows for seamless conversion of DateTimeFields to JalaliDateTimeFields within the admin site, view, and templates.
  • Dependency: Requires the installation of the jdatetime and pytz modules.

Installation:

To install this module, follow these steps:

  1. Install the required modules:
pip install jdatetime pytz
  1. Add 'jalali_date' to your INSTALLED_APPS in the settings.py file.
  2. Customize the default display of dates by overriding the Strftime function.
  3. Optionally, change the date picker to your preferred one by overriding the Static function.
  4. If you want the names of the dates to be displayed in Farsi, add the appropriate command to the settings.py file depending on your operating system.

For Windows:

import locale

locale.setlocale(locale.LC_ALL, 'fa_IR')

For other operating systems:

import locale

locale.setlocale(locale.LC_ALL, 'fa_IR.UTF-8')
  1. Lastly, make any necessary modifications to your views.py, forms.py, template.htmlexample-template-form, admin.py, and list-displayexample-admin files to incorporate the Jalali date functionality.

Summary:

The Django Jalali Date module provides support for displaying and manipulating Jalali dates in the Django user interface. It offers easy conversion of DateTimeFields to JalaliDateTimeFields and requires the installation of the jdatetime and pytz modules. Installation is straightforward and customization options are available for the date display and picker.