T
T
tanyaa2017-10-05 16:01:21
Django
tanyaa, 2017-10-05 16:01:21

How to reorder fields in a Django FilterSet?

Good afternoon.
How to make the fields in the filter appear on the page in the order in which they are specified in the fields parameter?
Filters.py:

class CasesFilter(django_filters.FilterSet):

    Field1=DateTimeFromToRangeFilter()
    Field2=DateTimeFromToRangeFilter()
    class Meta:
        model = Model1

        fields={'id' :['exact'],
                'Field1':['exact'],
                'Field2':['exact'],
                'Field3':['exact'],

        }

template:
<div >
    <form action="" method="get" class="form-inline">
        {{filter.form|crispy }}
       
            <input type="submit" value="Искать" />
       
    </form>

</div>

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question