mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-24 02:24:03 +03:00
Allow RawQuerySet serialization
This commit is contained in:
parent
e53c819cc7
commit
b689db17b3
|
@ -2,7 +2,7 @@
|
||||||
Customizable serialization.
|
Customizable serialization.
|
||||||
"""
|
"""
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from django.db.models.query import QuerySet
|
from django.db.models.query import QuerySet, RawQuerySet
|
||||||
from django.utils.encoding import smart_unicode, is_protected_type, smart_str
|
from django.utils.encoding import smart_unicode, is_protected_type, smart_str
|
||||||
|
|
||||||
import inspect
|
import inspect
|
||||||
|
@ -261,7 +261,7 @@ class Serializer(object):
|
||||||
if isinstance(obj, (dict, models.Model)):
|
if isinstance(obj, (dict, models.Model)):
|
||||||
# Model instances & dictionaries
|
# Model instances & dictionaries
|
||||||
return self.serialize_model(obj)
|
return self.serialize_model(obj)
|
||||||
elif isinstance(obj, (tuple, list, set, QuerySet, types.GeneratorType)):
|
elif isinstance(obj, (tuple, list, set, QuerySet, RawQuerySet, types.GeneratorType)):
|
||||||
# basic iterables
|
# basic iterables
|
||||||
return self.serialize_iter(obj)
|
return self.serialize_iter(obj)
|
||||||
elif isinstance(obj, models.Manager):
|
elif isinstance(obj, models.Manager):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user