silentsokolov / django-admin-rangefilter

A Django app that lets you filter data by date range and numeric range in the admin UI
MIT License
721 stars 106 forks source link

Adding blocks to the template / customizing filter name #58

Closed RamezIssac closed 3 years ago

RamezIssac commented 3 years ago

Hello !! Thank yo for this nice app !!

I faced an issue not being able to customize the range filter name,,, it takes a field verbose name but sometimes that's not clear enough. And the date_filter template does not provide any blocks to extend it..

silentsokolov commented 3 years ago

In the next release ...

@admin.register(Post)
class PostAdmin(admin.ModelAdmin):
    list_filter = (
        ('created_at', DateRangeFilter),
    )

    # If you would like to change a title range filter
    def get_rangefilter_created_at_title(self, request, field_path):
        return 'custom title'
RamezIssac commented 3 years ago

Brilliant ! Thanks.