8👍
Hasan is right in pointing out many=True
.
What it means in DRF is that since your serializer.data
is going to be a list and each item in the list needs to be converted to python datatypes that further will be easily rendered into JSON, XML.
Do not be confused with the many-to-many relation.
- Django's annotate Count with division returns integer instead of float
- How to use a tsvector field to perform ranking in Django with postgresql full-text search?
0👍
When ever you get the "AttributeError" on serializer, always see the last part where it says ‘the original exception was…’. This is why the actual error occurs. E.g
"Got AttributeError when attempting to get a value for field `name` on
serializer `RegionSerializer`.\nThe serializer field might be named
incorrectly and not match any attribute or key on the `QuerySet`
instance.\nOriginal exception text was: 'QuerySet' object has no attribute
'name'."
Here, as you can see, the end part which is "QuerySet" object has not attribute xyz .
Hope it is helpful
👤Nomi
- Error: Cursor' object has no attribute '_last_executed
- In Django loaddata it throws errors for json format but work properly for yaml format, why?
Source:stackexchange.com