Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No submit button with Django-filters + Crispy forms #3636

Closed
nanuxbe opened this issue Nov 15, 2015 · 6 comments
Closed

No submit button with Django-filters + Crispy forms #3636

nanuxbe opened this issue Nov 15, 2015 · 6 comments
Labels
Milestone

Comments

@nanuxbe
Copy link
Contributor

nanuxbe commented Nov 15, 2015

When using DjangoFilterBackend (might happen with other backends too but I didn't get a chance to test it) and crispy forms is installed, filter forms have no Submit button.

See attached screenshot:
image

@xordoquy
Copy link
Collaborator

xordoquy commented Nov 15, 2015

@nanuxbe thanks for the report. Do you have some sample project we could test against ? If not I'll set one up.

@nanuxbe
Copy link
Contributor Author

nanuxbe commented Nov 16, 2015

@xordoquy this is highly pre-alpha but I just pushed https://bitbucket.org/levit_scs/djember_back, this is the project the screenshot is taken from. It is tested under python 3.5 (which I didn't mention in the initial report)

To reproduce:

  • copy environ.py.dist to environ.py and edit to fit your local settings. (Postgres database is required)
  • uncomment crispy_forms from INSTALLED_APPS in settings.py

The only api implementing filters so far is available at http://localhost:8000/api/v1/postalcodes/

@xordoquy
Copy link
Collaborator

xordoquy commented Nov 16, 2015

@nanuxbe thanks a lot, will look at this today

@xordoquy xordoquy added this to the 3.3.2 Release milestone Nov 16, 2015
@xordoquy xordoquy added the Bug label Nov 16, 2015
@jpadilla
Copy link
Member

jpadilla commented Nov 18, 2015

@nanuxbe So the problem here is that PostalCodeFilter inherits from django_filters.FilterSet instead of rest_framework.filters.FilterSet.

@tomchristie @xordoquy should people inherit instead from rest_framework.filters.FilterSet if they want their filter forms in HTML views?

@nanuxbe
Copy link
Contributor Author

nanuxbe commented Nov 18, 2015

@jpadilla thanks 😄

If inheriting from rest_framework.filters.FilterSet is the way to go then the documentation here needs to be updated.

@carltongibson
Copy link
Collaborator

carltongibson commented Nov 18, 2015

The Crispy Forms FormHelper is not set on the form for a django_filters.FilterSet subclass. (This is what rest_framework.filters.FilterSet does.)

But the selected template assumes that a FormHelper will be present if crispy forms is installed. We could make that check at runtime when rendering the form

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants