mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-03 20:10:10 +03:00
Test current behavior of exclude+declared field
This commit is contained in:
parent
265375c104
commit
0b72285f0e
|
@ -900,6 +900,16 @@ class TestSerializerMetaClass(TestCase):
|
|||
"Cannot set both 'fields' and 'exclude' options on serializer ExampleSerializer."
|
||||
)
|
||||
|
||||
def test_declared_fields_with_exclude_option(self):
|
||||
class ExampleSerializer(serializers.ModelSerializer):
|
||||
text = serializers.CharField()
|
||||
|
||||
class Meta:
|
||||
model = MetaClassTestModel
|
||||
exclude = ('text',)
|
||||
|
||||
assert list(ExampleSerializer().fields) == ['id', 'text']
|
||||
|
||||
|
||||
class Issue2704TestCase(TestCase):
|
||||
def test_queryset_all(self):
|
||||
|
|
Loading…
Reference in New Issue
Block a user