Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
 into feature/ipaddress
  • Loading branch information
Ins1ne committed Feb 28, 2015
commit de72022f8036a010c1ca5d63a854c4ca4566233b
11 changes: 7 additions & 4 deletions rest_framework/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -731,9 +731,12 @@ class ModelSerializer(Serializer):
models.TimeField: TimeField,
models.URLField: URLField,
models.GenericIPAddressField: IPAddressField,
# Note: Some version-specific mappings also defined below.
})
_related_class = PrimaryKeyRelatedField
}
serializer_related_field = PrimaryKeyRelatedField
serializer_url_field = HyperlinkedIdentityField
serializer_choice_field = ChoiceField

# Default `create` and `update` behavior...

def create(self, validated_data):
"""
Expand Down Expand Up @@ -1347,7 +1350,7 @@ def get_unique_for_date_validators(self):

# IPAddressField is deprecated in Django
if hasattr(models, 'IPAddressField'):
ModelSerializer._field_mapping[models.IPAddressField] = IPAddressField
ModelSerializer.serializer_field_mapping[models.IPAddressField] = IPAddressField

if postgres_fields:
class CharMappingField(DictField):
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.