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

Support views with no model #56

Open
stevelacey opened this issue Sep 21, 2021 · 0 comments
Open

Support views with no model #56

stevelacey opened this issue Sep 21, 2021 · 0 comments

Comments

@stevelacey
Copy link
Contributor

stevelacey commented Sep 21, 2021

Worf currently raises ImproperlyConfigured if model is set to the default value of None, but None should probably be supported.

django.core.exceptions.ImproperlyConfigured: Model is not set on ...

If you set model to something else like False it then falls down when trying to build the filterset:

AttributeError: 'bool' object has no attribute '__name__'

Supplying your own queryset via get_queryset or response via get both bypass the need for a model which is handy in certain cases, currently the only way to suppress the error is to pass a model e.g. the django.db.models.Model abstract, even though it isn't used for anything meaningful.

wisersoftwareengineer added a commit to wisersoftwareengineer/worf that referenced this issue Mar 27, 2023
- test written to simulate a view with a dummy model to validate the scenario
wisersoftwareengineer added a commit to wisersoftwareengineer/worf that referenced this issue Mar 27, 2023
wisersoftwareengineer added a commit to wisersoftwareengineer/worf that referenced this issue Mar 27, 2023
- Created a workaround to user a fake model
- updated documentation explaining how to use it
wisersoftwareengineer added a commit to wisersoftwareengineer/worf that referenced this issue Mar 27, 2023
- Created a workaround to user a fake model
- updated documentation explaining how to use it
wisersoftwareengineer added a commit to wisersoftwareengineer/worf that referenced this issue Mar 27, 2023
- using a custom serializer to have an example for the users
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant