OPTIONS method on a listview calls get_object()
which fails an assertion #7757
Replies: 5 comments
-
Which is strange because |
Beta Was this translation helpful? Give feedback.
-
Hello, same error over here! When I enable OPTIONS and PUT, I get an AssertionError. Example over here:
Exception Type: AssertionError at /api/v1/employee/ I get the same traceback. I think you guys missed adding an AssertionError in the except in /rest_framework/metadata.py line 88 (but I don't know the framework well). Thanks, |
Beta Was this translation helpful? Give feedback.
-
@xordoquy did you get this info? |
Beta Was this translation helpful? Give feedback.
-
I have this same problem. OPTIONS on some object works fine. OPTIONS on the list fails in the same way. My viewset is very comparable to @narrowfail. If I remove the lookup_field argument everything works as intended. |
Beta Was this translation helpful? Give feedback.
-
@xordoquy can you check this Issue? |
Beta Was this translation helpful? Give feedback.
-
When I send OPTIONS request to this view, it tries to call
generics.GenericAPIView.get_object()
method which raises assertion error, because there is nopk
argument in url pattern, which is not needed because this is a list view.URL pattern:
View class:
When I send this request:
http --auth username:password options localhost:8000/api/services
Here's the traceback:
OPTIONS
method was used to work when I subclassedAPIView
for views, but now that I'm subclassinggenerics.GenericAPIView
, It fails.Django REST framework 3.3.3, Django 1.8.11, Python 2.7.6, Ubuntu 14.04
Beta Was this translation helpful? Give feedback.
All reactions