monim67 / django-flatpickr

Flatpicker based DatePickerInput, TimePickerInput and DateTimePickerInput with date-range-picker functionality for django >= 2.0
https://pypi.org/project/django-flatpickr/
MIT License
63 stars 11 forks source link

Can not integrate Date widget to Django User Sign Up form. #3

Closed ghost closed 3 years ago

ghost commented 5 years ago

Describe the problem Calendar widget is not displaying when I click on a date field,

To Reproduce forms.py

class CustomUserCreationForm(UserCreationForm):
    class Meta(UserCreationForm.Meta):
        model = CustomUser
        fields = ('first_name', 'last_name', 'date_of_birth', 'email')
        widgets = {
            'date_of_birth': DatePickerInput(),
        }

template

{% extends 'base.html' %}
{% block title %}Sign Up{% endblock %}
{% block extra_css %}
    {{ form.media.css }}
{% endblock %}
{% block extra_js %}
    {{ form.media.js }}
{% endblock %}
{% block content %}
    <h2>Sign up</h2>
    <form method="post">
        {% csrf_token %}
        {{ form.as_p }}
        <button type="submit">Sign up</button>
    </form>
{% endblock %}

Expected behavior The calendar should be displayed when I click on a date field.

Console errors

Setup Information

monim67 commented 5 years ago

Does your base template contain extra_css and extra_js blocks?