How to fix positioning of dropdowns when using django-autocomplete-light and crispy forms
Django-autocomplete-light library provides a great way
to implement select widget with autocomplete feature in Django forms. I used it, and I am very happy with the result.
But my form was still pretty ugly and the obvious and popular solution is to fix it with
django-crispy-forms library. I love it! It’s easily configurable
in the form class, and the only thing in the template to render the form is {% crispy form %}
. Nice and clean!
However, nothing is that easy, right? After adding {% crispy %} tag, my form became messier than ever. Autocomplete selects were totally different from other fields in the form.
This is how the ugly form looks like:
Solution
I have spent quite some time to fix the CSS, so if I ever encounter this problem again, here is the solution:
The nice form as the result: