mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-02-04 05:34:40 +03:00
Merge pull request #3903 from charettes/deprecation-warnings-1.8
Silenced deprecation warnings on Django 1.8.
This commit is contained in:
commit
61f3ccf385
|
@ -251,7 +251,7 @@ def get_all_related_objects(opts):
|
||||||
:param opts: Options instance
|
:param opts: Options instance
|
||||||
:return: list of relations except many-to-many ones
|
:return: list of relations except many-to-many ones
|
||||||
"""
|
"""
|
||||||
if django.VERSION < (1, 9):
|
if django.VERSION < (1, 8):
|
||||||
return opts.get_all_related_objects()
|
return opts.get_all_related_objects()
|
||||||
else:
|
else:
|
||||||
return [r for r in opts.related_objects if not r.field.many_to_many]
|
return [r for r in opts.related_objects if not r.field.many_to_many]
|
||||||
|
@ -264,7 +264,7 @@ def get_all_related_many_to_many_objects(opts):
|
||||||
:param opts: Options instance
|
:param opts: Options instance
|
||||||
:return: list of many-to-many relations
|
:return: list of many-to-many relations
|
||||||
"""
|
"""
|
||||||
if django.VERSION < (1, 9):
|
if django.VERSION < (1, 8):
|
||||||
return opts.get_all_related_many_to_many_objects()
|
return opts.get_all_related_many_to_many_objects()
|
||||||
else:
|
else:
|
||||||
return [r for r in opts.related_objects if r.field.many_to_many]
|
return [r for r in opts.related_objects if r.field.many_to_many]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user