There was an error while loading. Please reload this page.
2 parents 7105c13 + d60ecfc commit e0096feCopy full SHA for e0096fe
rest_framework/serializers.py
@@ -880,6 +880,10 @@ def get_fields(self):
880
exclude = getattr(self.Meta, 'exclude', None)
881
if exclude is not None:
882
for field_name in exclude:
883
+ assert field_name in fields, (
884
+ 'The field in the `exclude` option must be a model field. Got %s.' %
885
+ field_name
886
+ )
887
fields.remove(field_name)
888
889
# Determine the set of model fields, and the fields that they map to.
0 commit comments