I want to use django-bootstrap-datepicker-plus, but an error has occurred and I cannot implement it.

Asked 1 years ago, Updated 1 years ago, 454 views

If you try to start the runserver in this state, an error will occur.If there is a solution, please take care of it.

error messages:

AttributeError: module 'bootstrap_datepicker_plus' has no attribute 'DatePickerInput'

source code:

models.py

 from django import forms
from django.contrib.auth.models import User
from.models import Account
import bootstrap_datepicker_plus as datetimepicker
# Form Class Creation
class AccountForm (forms.ModelForm):
    # password entry:hiding
    password=forms.CharField (widget=forms.PasswordInput(), label="password")

    class Meta():
        # user authentication
        model=User
        # field specification
        fields=('username', 'email', 'password')
        # field naming
        labels={'username':"User ID", 'email':"mail"}

classAddAccountForm(forms.ModelForm):
    class Meta():
        # Specify model class
        model=Account
        fields=('last_name', 'first_name', 'year')
        labels = {'last_name': "last name", 'first_name': "name", 'year': 'birthday'}

        widgets = {
            'year': datetimepicker.DatePickerInput(
                format = '%Y-%m-%d',
                options = {
                    locale: 'ja',
                    dayViewHeaderFormat: 'YYYYY Year MMMM',
                }
            ),
        }

settings.py

INSTALLED_APPS=[
    'django_bootstrap5',
    'bootstrap_datepicker_plus',
]

python django

2023-01-24 00:47

1 Answers

django-bootstrap-datepicker-plus has never been used, but as far as official site,

import bootstrap_datepicker_plus as datetimepicker

instead of

import bootstrap_datepicker_plus.widgets as datetimepicker

I have a feeling that , but what do you think?
Just in case, there seems to be an article like .


2023-01-24 00:50

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.