Skip to content

Commit

Permalink
Fixed queries without serializers.
Browse files Browse the repository at this point in the history
  • Loading branch information
iurisilvio committed May 18, 2021
1 parent e3ff53e commit c106731
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion django_qserializer/serialization.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ def to_serialize(self, serializer=None):

def _fetch_all(self):
super()._fetch_all()
self._serializer._prepare_objects(self._result_cache)
if self._serializer:
self._serializer._prepare_objects(self._result_cache)

def _clone(self):
c = super()._clone()
Expand Down
10 changes: 9 additions & 1 deletion django_qserializer/tests/test_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,12 @@ def serialize_object(self, obj):
'plate': obj.plate,
}

Bus.objects.to_serialize(S).first()
bus = Bus.objects.to_serialize(S).first()
bus.serialize()


def test_query_without_serializer(bus_fixture):
"""
Regression test. Query without serializer failed.
"""
Bus.objects.first()
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = django_qserializer
version = 0.2.5
version = 0.2.6
url = https://github.com/buserbrasil/django-qserializer
license = MIT
author = Iuri de Silvio
Expand Down

0 comments on commit c106731

Please sign in to comment.