Closed pmg103 closed 4 years ago
Bug discovered by @CharlieHarle which prevented fetching reverse many-to-many relations.
Eg this did not work:
class User(Model): id = UUIDField(primary_key=True, default=uuid.uuid4, editable=False) class UserGroup(Model): users = ManyToManyField(User, blank=True) class UsersList(SerializationSpecMixin, ListAPIView): queryset = User.objects.all() serialization_spec = [ {'usergroup_set': [ 'id', 'name' ]} ]
because it would try to prefetch users_id on the related UserGroup which isn't possible and fails with:
users_id
UserGroup
django.core.exceptions.FieldDoesNotExist: UserGroup has no field named 'users_id'
Bug discovered by @CharlieHarle which prevented fetching reverse many-to-many relations.
Eg this did not work:
because it would try to prefetch
users_id
on the relatedUserGroup
which isn't possible and fails with:django.core.exceptions.FieldDoesNotExist: UserGroup has no field named 'users_id'