Fix: query embeds are broken. (#2837)

This commit is contained in:
Arik Fraimovich 2018-09-20 10:36:15 +03:00 committed by GitHub
parent 1661553da7
commit ec39bb0779
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -69,7 +69,7 @@ class QuerySerializer(Serializer):
def serialize(self):
if isinstance(self.object_or_list, models.Query):
result = serialize_query(self.object_or_list, **self.options)
if self.options.get('with_favorite_state', True):
if self.options.get('with_favorite_state', True) and not current_user.is_api_user():
result['is_favorite'] = models.Favorite.is_favorite(current_user.id, self.object_or_list)
else:
result = [serialize_query(query, **self.options) for query in self.object_or_list]