Skip to content

Commit

Permalink
Merge pull request #2602 from dbrgn/fix-1602
Browse files Browse the repository at this point in the history
List resource not updated between requests
  • Loading branch information
tomchristie committed Feb 26, 2015
2 parents dafc045 + 86c5fa2 commit d219fc0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rest_framework/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from __future__ import unicode_literals
from django.db import models
from django.db.models.fields import FieldDoesNotExist, Field as DjangoModelField
from django.db.models import query
from django.utils.translation import ugettext_lazy as _
from rest_framework.compat import postgres_fields, unicode_to_repr
from rest_framework.utils import model_meta
Expand Down Expand Up @@ -562,7 +563,7 @@ def to_representation(self, data):
"""
# Dealing with nested relationships, data can be a Manager,
# so, first get a queryset from the Manager if needed
iterable = data.all() if isinstance(data, models.Manager) else data
iterable = data.all() if isinstance(data, (models.Manager, query.QuerySet)) else data
return [
self.child.to_representation(item) for item in iterable
]
Expand Down

0 comments on commit d219fc0

Please sign in to comment.