I have created django-filter in order to perform column filtering on django-table2, BUT I'm still unable to style the generated drop down list in order to match the overall page style
-I am using Bootsrap3
Kindly, post any suggestion to solve this issue, Or should I do the column filtering using regular django forms
Here is my filter class form filter.py
Pi_FILTER_CHOICES= (('', 'Select PI#'),(1,"PI1"),(2,"PI2"),(3,"PI3"),)
class PI_NameFilter(filters.FilterSet):
pi_name = filters.ChoiceFilter( label = "PI Name", choices=Pi_FILTER_CHOICES)
class Meta:
modle = SamplesLinkage
Here is the filter on my template
{% block filter %}
<form action="" method="get">
<label for="id_pi_name">Search by PI: </label>
{{ filter.form.pi_name }}
<button type="submit" class="btn btn-default btn-sm">
<span class="glyphicon glyphicon-search" aria-hidden="true"></span> Go Find
</button>
</form>
{% endblock %}
You (or at least anyone who will still face this issue in the future) will have to render form fields manually using this documentation: https://docs.djangoproject.com/en/1.11/topics/forms/#rendering-fields-manually
{{ form.non_field_errors }}
<div class="fieldWrapper">
{{ form.subject.errors }}
<label for="{{ form.subject.id_for_label }}">Email subject:</label>
{{ form.subject }}
</div>
<div class="fieldWrapper">
{{ form.message.errors }}
<label for="{{ form.message.id_for_label }}">Your message:</label>
{{ form.message }}
</div>
<div class="fieldWrapper">
{{ form.sender.errors }}
<label for="{{ form.sender.id_for_label }}">Your email address:</label>
{{ form.sender }}
</div>
<div class="fieldWrapper">
{{ form.cc_myself.errors }}
<label for="{{ form.cc_myself.id_for_label }}">CC yourself?</label>
{{ form.cc_myself }}
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With