Merge branch 'master' of git://github.com/tomchristie/django-rest-framework

This commit is contained in:
Adam Ness 2012-07-02 18:44:00 -07:00
commit 5311cc1012
6 changed files with 21 additions and 6 deletions

View File

@ -1,6 +1,11 @@
Release Notes
=============
0.4.0-dev
---------
* Markdown < 2.0 is no longer supported.
0.3.3
-----

View File

@ -26,7 +26,7 @@ We also have a `Jenkins service <http://jenkins.tibold.nl/job/djangorestframewor
Requirements:
* Python (2.5, 2.6, 2.7 supported)
* Django (1.2, 1.3, 1.4-alpha supported)
* Django (1.2, 1.3, 1.4 supported)
Installation Notes

View File

@ -370,6 +370,8 @@ else:
# Markdown is optional
try:
import markdown
if markdown.version_info < (2, 0):
raise ImportError('Markdown < 2.0 is not supported.')
class CustomSetextHeaderProcessor(markdown.blockprocessors.BlockProcessor):
"""

View File

@ -2,7 +2,7 @@
Customizable serialization.
"""
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
import inspect
@ -180,7 +180,8 @@ class Serializer(object):
else:
stack = self.stack[:]
return related_serializer(depth=depth, stack=stack).serialize(obj)
return related_serializer(depth=depth, stack=stack).serialize(
obj, request=getattr(self, 'request', None))
def serialize_max_depth(self, obj):
"""
@ -254,15 +255,19 @@ class Serializer(object):
"""
return smart_unicode(obj, strings_only=True)
def serialize(self, obj):
def serialize(self, obj, request=None):
"""
Convert any object into a serializable representation.
"""
# Request from related serializer.
if request is not None:
self.request = request
if isinstance(obj, (dict, models.Model)):
# Model instances & dictionaries
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
return self.serialize_iter(obj)
elif isinstance(obj, models.Manager):

View File

@ -7,7 +7,7 @@ Alternative frameworks
There are a number of alternative REST frameworks for Django:
* `django-piston <https://bitbucket.org/jespern/django-piston/wiki/Home>`_ is very mature, and has a large community behind it. This project was originally based on piston code in parts.
* `django-tasypie <https://github.com/toastdriven/django-tastypie>`_ is also very good, and has a very active and helpful developer community and maintainers.
* `django-tastypie <https://github.com/toastdriven/django-tastypie>`_ is also very good, and has a very active and helpful developer community and maintainers.
* Other interesting projects include `dagny <https://github.com/zacharyvoase/dagny>`_ and `dj-webmachine <http://benoitc.github.com/dj-webmachine/>`_

View File

@ -64,6 +64,9 @@ setup(
package_data=get_package_data('djangorestframework'),
test_suite='djangorestframework.runtests.runcoverage.main',
install_requires=['URLObject>=0.6.0'],
extras_require={
'markdown': ["Markdown>=2.0"]
},
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Web Environment',