Thiết lập placeholder riêng cho rangefilter

Django set different placeholders for RangeFilter or DateFromToRangeFilter

By default MultiWidget passes all attrs to each subwidget. To bypass this, you would have to subclass RangeWidget and provide separate attrs parameters for each of the from/to widgets.

If we use RangeFilter as blow source code, both input fields will be display ‘from’ in placeholder

In order to set difference placeholder for each input field, we have to define a new RangeWidget. This is the source code

Below is source code that we use the RangeWidget:


Leave a Reply

Your email address will not be published. Required fields are marked *