'bootstrap datepicker not working in django

i am trying to integrate bootstrap datepicker but its not working

setting.py:

INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'main_site',
'crispy_forms',
'bootstrap_datepicker_plus',
'bootstrap4'

]

forms.py:

from django import forms
import datetime 
from bootstrap_datepicker_plus import DatePickerInput 

class BookartistForm(forms.Form):
    name = forms.CharField()
    email = forms.EmailField(label = 'email', required=False)
    number = forms.CharField(required=False)
    artist_name = forms.CharField(required=False)
 artist_category = forms.ChoiceField(choices = [('singer','Singer'),('dancer','Dancer'),('comedian','Comedian'),('model','Model'),('celebrities','Celebrities'),('photographer','Photographer')])
#Event_Type = forms.ChoiceField( choices = [('question','Question'),('other','Other')])
budget = forms.CharField(required=False)
date = forms.DateField(widget=DatePickerInput(format='%m/%d/%Y'))
location = forms.CharField(required=False)
description = forms.CharField(widget = forms.Textarea, required=False)

html template:

{% extends 'main_site/base.html' %}
{% load static %}
{% block content %}
{% load crispy_forms_tags %}
{% load bootstrap4 %}
{% bootstrap_css %}
{% bootstrap_javascript jquery='full' %}
<div class="container">
 <section>
    <form method = 'post'>
     {% csrf_token %}

        {{ form|crispy }}
    <button type="submit" class="bg bg-primary">Submit</button>
    </form>

</section>

{% endblock content%}

also its unable to import on forms.py as i get error showing this: unable to import bootstrap datepicker_plus

this is the output i'm getting form output

edit:

i have installed these dependency:

(venv) tboss@Tboss:~/Desktop/environment/celeb/celeb$ pip install django-bootsap4
 Requirement already satisfied: django-bootstrap4 in /home/tboss/Desktop/environment/celeb/venv/lib/python3.7/site-packages (0.0.8)

requirements.txt:

Django==2.2
django-bootstrap-datepicker-plus==3.0.5
django-crispy-forms==1.7.2
Pillow==6.1.0
pkg-resources==0.0.0
psycopg2==2.8.1
psycopg2-binary==2.8.2
pytz==2019.1
sqlparse==0.3.0



(venv) tboss@Tboss:~/Desktop/environment/celeb/celeb$ pip install django- bootstrap-datepicker-plus
Requirement already satisfied: django-bootstrap-datepicker-plus in /home/tboss/Desktop/environment/celeb/venv/lib/python3.7/site-packages (3.0.5)
Requirement already satisfied: django>=1.8 in /home/tboss/Desktop/environment/celeb/venv/lib/python3.7/site-packages (from django-bootstrap-datepicker-plus) (2.2)
Requirement already satisfied: pytz in /home/tboss/Desktop/environment/celeb/venv/lib/python3.7/site-packages (from django>=1.8->django-bootstrap-datepicker-plus) (2019.1)
Requirement already satisfied: sqlparse in /home/tboss/Desktop/environment/celeb/venv/lib/python3.7/site-packages (from django>=1.8->django-bootstrap-datepicker-plus) (0.3.0)

maybe this is error: bootstrapdatepicker



Solution 1:[1]

I think your question should be the other way around, the reason for your DatePicker not showing up is most likely due to the import error, so that's where you should start.

I looked through your code and tested it myself, and it seems to work fine here, so I think it's the dependencies.

Double-check that you have installed bootstrap and bootstrapper-datepicker-plus

pip install django-bootstrap4

pip install django-bootstrap-datepicker-plus

Stop and start your django server and see if anything has changed.

If you're still recieving the import error, please post the entire error report here, as I presume you typed the other error since there's a _ missing(or something's wrong there).

I would have liked to commented first and ask for more information, but unfortunately, I can't.

Solution 2:[2]

you should import it like this:

from bootstrap_datepicker_plus.widgets import DateTimePickerInput

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Javad Nikbakht