zinon
zinon

Reputation: 4664

Django: View only year in DateTimePicker widget

If forms.py I have:

 self.fields['current_treatment_chelation_start']= forms.DateField(label=('Start of chelation therapy'),required=False,
    widget=DateTimePicker(options={"format": "YYYY",
                                   "pickTime": False,
                                   "startDate": "1900"}))

This shows me the date in calendar. I want the user to view only years and select one.

Any help?

Upvotes: 0

Views: 1378

Answers (1)

FlipperPA
FlipperPA

Reputation: 14311

Assuming you're using this package:

https://github.com/nkunihiko/django-bootstrap3-datetimepicker

You'll want to add this to your DateTimePicker options:

viewMode: 'years',

Upvotes: 1

Related Questions