a-roomana / django-jalali-date

Jalali Date support for user interface. Easy conversion of DateTimeFiled to JalaliDateTimeField within the admin site, views, forms and templates.
MIT License
308 stars 33 forks source link

Add support for Auto converting list_display Date/Datetime fields to jalali #57

Closed AmirMahmood closed 9 months ago

AmirMahmood commented 2 years ago

I overrode get_list_display function of ModelAdmin to replace date/datetime model fields in list_display with a callable that converts date/datetime to jalali and automatically adds short_description property.

AmirMahmood commented 2 years ago

LIST_DISPLAY_AUTO_CONVERT setting has been added to enable or disable the auto list_display converting functionality from the JALALI_DATE_DEFAULTS settings. the LIST_DISPLAY_AUTO_CONVERT default value is False, so projects using this library will not have any unwanted changes after updating this library and must explicitly enable auto list_display converting functionality by setting JALALI_DATE_DEFAULTS True.