I'm new to Django and I'm trying to find the Django Admin date picker widget. I have search but got no results. Could anyone help me to use it on the project I'm working on?
I have a datetimefield in my model, like this:
fin = models.DateTimeField()
When creating a model from the admin is shows the widget but when I do it from the project it doesn't.
Specify the widget in your form as follows:
from django.contrib.admin.widgets import AdminDateWidget
class YourForm(forms.ModelForm):
from_date = forms.DateField(widget=AdminDateWidget())
Don't forget to include the scripts and css in your template:
{{ form.media }}