2

I have a model defined as such in my models.py:

class xx(models.Model):
    ...
    dob = models.DateField(verbose_name="Date of birth", blank=True)
    ...

It is not showing up in my admin interface using the django datetime picker. It was showing up initially as desired, but then I overrode the change_form.html for writing some js, and that's screwed it up I guess. Commenting out the js also doesn't help so I'm not able to narrow down the issue. Any leads?

Chetan
  • 1,724
  • 2
  • 14
  • 18
  • The same exact thing has happened to me, right after trying to add tinymce to the admin interface. I still havn't worked it out. – Nicolas Mar 16 '19 at 06:45

1 Answers1

2

I was able to get around it by overriding the widget in the Meta class:

class Meta:
    ...
    widgets = {'dob': forms.DateInput(attrs={'type':'date'}),}
    ...

This helped: How to use a JQuery Datepicker with the Django template language

However, I don't understand clearly as to why I had to override the widget? How was the default behavior effected?

Community
  • 1
  • 1
Chetan
  • 1,724
  • 2
  • 14
  • 18