slashmili / django-jalali

Jalali DateField support for Django model
http://pypi.python.org/pypi/django_jalali
BSD 3-Clause "New" or "Revised" License
254 stars 53 forks source link

jalali datepicker #64

Closed alinavaie closed 6 years ago

alinavaie commented 6 years ago

Hi, I use djnagi-jalali with python 3 , everything is working well (such as templates) but 2 issues: 1- the datepicker widget is still in Gregorian. So I have to choose the date in Gregorian and then convert it to jalali with template. 2- I got locale.Error when I try to import Farsi locale in setting.py

slashmili commented 6 years ago

@alinavaie which version of django and which version of django-jalali are you using?

for the second issuer, can you past the stack trace?

alinavaie commented 6 years ago

django==1.11.6 django-jalali==2.4.5

(Development) Alirezas-MacBook-Air:Unita2 alirezasarinavaie$ python manage.py runserver Traceback (most recent call last): File "manage.py", line 22, in execute_from_command_line(sys.argv) File "/Users/alirezasarinavaie/Desktop/Development/lib/python3.6/site-packages/django/core/management/init.py", line 364, in ex ecute_from_command_line utility.execute() File "/Users/alirezasarinavaie/Desktop/Development/lib/python3.6/site-packages/django/core/management/init.py", line 308, in ex ecute settings.INSTALLED_APPS File "/Users/alirezasarinavaie/Desktop/Development/lib/python3.6/site-packages/django/conf/init.py", line 56, in getattr self._setup(name) File "/Users/alirezasarinavaie/Desktop/Development/lib/python3.6/site-packages/django/conf/init.py", line 41, in _setup

self._wrapped = Settings(settings_module)

File "/Users/alirezasarinavaie/Desktop/Development/lib/python3.6/site-packages/django/conf/init.py", line 110, in init mod = importlib.import_module(self.SETTINGS_MODULE) File "/Users/alirezasarinavaie/Desktop/Development/lib/python3.6/importlib/init.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 994, in _gcd_import File "", line 971, in _find_and_load File "", line 955, in _find_and_load_unlocked File "", line 665, in _load_unlocked File "", line 678, in exec_module File "", line 219, in _call_with_frames_removed File "/Users/alirezasarinavaie/Desktop/Development/Projects/Unita2/Unita2/settings.py", line 124, in locale.setlocale(locale.LC_ALL, "fa_IR") File "/Users/alirezasarinavaie/Desktop/Development/lib/python3.6/locale.py", line 598, in setlocale return _setlocale(category, locale) locale.Error: unsupported locale setting

slashmili commented 6 years ago

@alinavaie I tried the example code which is here

  1. The widget works fine. Try to set the example code up and compare the code with your project
    #pip Django and django_jalali if you don't have them
    python manage.py migrate
    python manage.py createsuperuser
    python manage.py runserver

and visit http://localhost:8000/admin/foo/bartime/

  1. Looks like Mac locale system is broken for some languages including fa_IR :(

If you are using linux you can add fa_IR locale using

sudo dpkg-reconfigure locales