-
Notifications
You must be signed in to change notification settings - Fork 57
Open
Description
I've tried three different strategies, none works:
-
in the field definition:
date_from = DateTimeField(label=_('Date from'),
initial='{:%Y-%m-%d}'.format(datetime.date.today()),
required=True
) -
In the form init:
def init(self, *args, **kwargs):
updated_initial = {}
updated_initial['date_from'] = '{:%Y-%m-%d}'.format(datetime.date.today())
kwargs.update(initial=updated_initial)
super().init(*args, **kwargs) -
In the get_initial of the BrowseView that uses this form:
def get_initial(self):
initial = super().get_initial()
initial['date_from'] = '{:%Y-%m-%d}'.format(datetime.date.today())
return initial
None of them works. Any ideas on how to populate the FilterForm of the BrowseView with initial values?
Metadata
Metadata
Assignees
Labels
No labels