|
1 | 1 | from __future__ import unicode_literals
|
2 | 2 |
|
3 |
| -import collections |
4 | 3 | import copy
|
5 | 4 | import datetime
|
6 | 5 | import decimal
|
|
33 | 32 |
|
34 | 33 | from rest_framework import ISO_8601
|
35 | 34 | from rest_framework.compat import (
|
36 |
| - MaxLengthValidator, MaxValueValidator, MinLengthValidator, |
| 35 | + Mapping, MaxLengthValidator, MaxValueValidator, MinLengthValidator, |
37 | 36 | MinValueValidator, ProhibitNullCharactersValidator, unicode_repr,
|
38 | 37 | unicode_to_repr
|
39 | 38 | )
|
@@ -96,7 +95,7 @@ def get_attribute(instance, attrs):
|
96 | 95 | """
|
97 | 96 | for attr in attrs:
|
98 | 97 | try:
|
99 |
| - if isinstance(instance, collections.Mapping): |
| 98 | + if isinstance(instance, Mapping): |
100 | 99 | instance = instance[attr]
|
101 | 100 | else:
|
102 | 101 | instance = getattr(instance, attr)
|
@@ -1661,7 +1660,7 @@ def to_internal_value(self, data):
|
1661 | 1660 | """
|
1662 | 1661 | if html.is_html_input(data):
|
1663 | 1662 | data = html.parse_html_list(data, default=[])
|
1664 |
| - if isinstance(data, type('')) or isinstance(data, collections.Mapping) or not hasattr(data, '__iter__'): |
| 1663 | + if isinstance(data, type('')) or isinstance(data, Mapping) or not hasattr(data, '__iter__'): |
1665 | 1664 | self.fail('not_a_list', input_type=type(data).__name__)
|
1666 | 1665 | if not self.allow_empty and len(data) == 0:
|
1667 | 1666 | self.fail('empty')
|
|
0 commit comments