-
Notifications
You must be signed in to change notification settings - Fork 265
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
AttributeError: 'ListSerializer' object has no attribute 'Meta' #404
Comments
hi @treussart, nice catch! would you like to do a separate PR for that "scim commit"? i'm not fully sold on the args PR but this i would like to include. if you don't care, i can cherry-pick the commit. i can add a regression test later on. |
Hi @treussart, sry to keep you waiting. while constructing a test something simply didn't sit right with me. i'm sure your fix did it for you, but i believe its not entirely correct. also this wraps with an array one time too many. i think the core issue is that this piece of code did not account for please confirm these assumptions i made. it was not clear from the example:
could you try the following snippet instead? i think this is likely the correct fix. ...
assert field.source_attrs, f'ReadOnlyField "{field}" needs a proper source'
if is_list_serializer(field.parent):
field = field.parent
target = follow_field_source(field.parent.Meta.model, field.source_attrs)
if callable(target):
... EDIT: i changed the snipped. my previous proposal had one remaining issue. it's even simpler now. |
Hi, I test your code and there is a new warning: Warning #0: UserViewSet: UserSerializer: unable to resolve type hint for function "all_groups". Consider using a type hint or @extend_schema_field. Defaulting to string.
|
at least we are making progress 😄 i added some hint detection. |
Hi, thanks for the correction, I rebased my branch on master and it's good for me. |
awesome! i'll close this then. |
Describe the bug
I get this error:
To Reproduce
This is the problematic field:
For fix the problem I patched openapi.py line 649:
Expected behavior
No error. and understand my read-only serializer.
The text was updated successfully, but these errors were encountered: