-
Notifications
You must be signed in to change notification settings - Fork 299
Avoid AttributeError
for PUT and PATCH methods when using APIView
#778
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
Conversation
Update my fork
As lookup_field
and lookup_url_kwarg
are set in GenericAPIView
can you give an example in what case a lookup field is actually not set?
@sliverc both of these fields aren't set whenever you use default APIView
. It is a valid DRF behavior.
UPD: I think I should explain a little bit more. Nothing stops a user to define APIView
whatever they want and set DRF-JA JSONParser
and JSONRenderer
to obtain JSON-API endpoint without an underlying model using some plain serializer. It is not a common case, but we have this usage in our product.
The problem here is that AttributeError
you supposed to expect here is caught by DRF request proxy without any notification and unfortunately there is nothing we can do with such behavior.
Codecov Report
@@ Coverage Diff @@ ## master #778 +/- ## ========================================== + Coverage 97.16% 97.21% +0.04% ========================================== Files 55 55 Lines 2825 2874 +49 ========================================== + Hits 2745 2794 +49 Misses 80 80
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense. Could you follow up by adding a test and changelog entry then? Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. This looks good.
AttributeError
for PUT and PATCH methods when using APIView
(追記ここまで)
Uh oh!
There was an error while loading. Please reload this page.
Fixes silenced AttributeError in the case when
lookup_url_kwarg
doesn't exist in a viewDescription of the Change
Checklist
CHANGELOG.md
updated (only for user relevant changes)AUTHORS