Closed Gilbishkosma closed 5 years ago
Is there any way i can change the tilte?
The title is name a model's field. If you need other the title override the template rangefilter/templates/rangefilter/date_filter.html
. Or override a filter like in this answer
then i can easily pass a title for the field . for ex: (('date','Todays Date'),)
I don't know, but it doesn't work.
Django 2.2
admin.py
list_filter = (
('created_at', 'Cool custom name'),
)
Out:
ERRORS:
<class 'simple.admin.PostAdmin'>: (admin.E115) The value of 'list_filter[0][1]' must inherit from 'FieldListFilter'.
Easier workaround for this issue:
list_filter = (
('rooms__occupancies__start', DateRangeFilter),
)
def get_changelist_instance(self, request):
instance = super().get_changelist_instance(request)
instance.filter_specs[0].title = 'occupancy date'
return instance
how to replace the title with the selected dates after submission?
@vaishakhahk you have 2 ways: either override the rangefilter's logic or override the template with use jQuery for replace the title (depending on url's path)
How should i change the title of date field in filter ? If i don't use the DateRangeFilter then i can easily pass a title for the field . for ex: (('date','Todays Date'),) ,but now i am using DateRangeFilter. Is there any way i can change the tilte?