django-bootstrap-datepicker-plus: Calendar not showing up in a MODAL Form
Calendar not showing up in a Modal form for the first time. If I close the modal and open it again, calendar starts working.
Here is an error in console log I get:
jquery.min.js:2 Uncaught TypeError: $element.datetimepicker is not a function
at HTMLInputElement.<anonymous> (<anonymous>:14:38)
at Function.each (jquery.min.js:2)
at w.fn.init.each (jquery.min.js:2)
at HTMLDocument.<anonymous> (<anonymous>:7:38)
at l (jquery.min.js:2)
at c (jquery.min.js:2)
About this issue
- Original URL
- State: open
- Created 4 years ago
- Reactions: 1
- Comments: 20
β added to my base.html to be extended in other templates β added the
{{ form.media }}
in my modal form template where I want my calendar to show before the start of<form>
tagsβIn forms.py
Hope this is what you are looking for and It helps. With this structure a calendar is shown on a Modal form and a timepicker too thanks.
@templargin The only other thing I can suggest without seeing all of your code is that make sure you load {{contact_form.media}} in your base.html and again from your modal template
Hello,
if you add the form as a context processor and load it into your base template it will work fine. The modal needs to load the css and js before it renders the form.
app_name/context_processors.py
settings.py
base.html
{{quote_form.media}}