Skip to content

Date picker not shown in html template #146

Closed Answered by hramezani
Mehran-Isapour asked this question in Q&A
Discussion options

You must be logged in to vote

forms.widgets.jDateTimeInput is a form widget not a date picker.
If you want to have admin date picker in your form you have to use admin.widgets.AdminSplitjDateTime for DateTimeField and admin.widgets.AdminjDateWidget for DateField.
To enable it for your model form first import it:

from django_jalali.admin import widgets

and use it like:

widgets = {'datetime': widgets.AdminSplitjDateTime} 

Then, you need to include admin related js files in your template by:

 <script type="text/javascript" src="/admin/jsi18n/"></script>
 <script type="text/javascript" src="/static/admin/js/core.js"></script>

Replies: 9 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@htabar
Comment options

@htabar
Comment options

Answer selected by slashmili
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@javadbayani
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
6 participants
Converted from issue

This discussion was converted from issue #117 on September 20, 2021 04:04.