mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-29 21:14:01 +03:00
Update comments
This commit is contained in:
parent
4ddc661b01
commit
c0155fd9dc
|
@ -410,10 +410,12 @@ class ModelSerializer(Serializer):
|
||||||
info = model_meta.get_field_info(self.opts.model)
|
info = model_meta.get_field_info(self.opts.model)
|
||||||
ret = SortedDict()
|
ret = SortedDict()
|
||||||
|
|
||||||
|
# URL field
|
||||||
serializer_url_field = self.get_url_field()
|
serializer_url_field = self.get_url_field()
|
||||||
if serializer_url_field:
|
if serializer_url_field:
|
||||||
ret[api_settings.URL_FIELD_NAME] = serializer_url_field
|
ret[api_settings.URL_FIELD_NAME] = serializer_url_field
|
||||||
|
|
||||||
|
# Primary key field
|
||||||
field_name = info.pk.name
|
field_name = info.pk.name
|
||||||
serializer_pk_field = self.get_pk_field(field_name, info.pk)
|
serializer_pk_field = self.get_pk_field(field_name, info.pk)
|
||||||
if serializer_pk_field:
|
if serializer_pk_field:
|
||||||
|
|
|
@ -14,7 +14,7 @@ def dedent(blocktext):
|
||||||
return '\n'.join([line[12:] for line in blocktext.splitlines()[1:-1]])
|
return '\n'.join([line[12:] for line in blocktext.splitlines()[1:-1]])
|
||||||
|
|
||||||
|
|
||||||
# Models for testing regular field mapping
|
# Testing regular field mappings
|
||||||
|
|
||||||
class RegularFieldsModel(models.Model):
|
class RegularFieldsModel(models.Model):
|
||||||
auto_field = models.AutoField(primary_key=True)
|
auto_field = models.AutoField(primary_key=True)
|
||||||
|
@ -70,7 +70,7 @@ class TestRegularFieldMappings(TestCase):
|
||||||
self.assertEqual(repr(TestSerializer()), expected)
|
self.assertEqual(repr(TestSerializer()), expected)
|
||||||
|
|
||||||
|
|
||||||
# Model for testing relational field mapping
|
# Testing relational field mappings
|
||||||
|
|
||||||
class ForeignKeyTargetModel(models.Model):
|
class ForeignKeyTargetModel(models.Model):
|
||||||
name = models.CharField(max_length=100)
|
name = models.CharField(max_length=100)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user