Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Customize crispy form for django-filter

I'm trying to customize form in django using django-crispy-forms and django-filter extensions. Here is my form snippet:

class FilterForm(Form):
    def __init__(self, *args, **kwargs):
        super(FilterForm, self).__init__(*args, **kwargs)
        self.helper = FormHelper()
        self.helper.form_method = 'get'

        self.helper.layout = Layout(
            Row(
                Div('country', css_class='col-sm-3'),
                Div('brand', css_class='col-sm-3'),
            )
        )

This is how the layout looks like in browser:

enter image description here

So my questions are: how do I remove p tag with "Filter" text in it and why the arrow button of select control shrinks like this?

like image 937
Михаил Павлов Avatar asked Mar 31 '26 10:03

Михаил Павлов


1 Answers

To disable paragraph with help text I used this setting

FILTERS_HELP_TEXT_FILTER = False

The style of select box has to do with the bootstrap/firefox issue. Workaround is to restyle select box in css.

like image 62
Михаил Павлов Avatar answered Apr 03 '26 02:04

Михаил Павлов



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!