Update comments

This commit is contained in:
Tom Christie 2014-09-17 14:11:53 +01:00
parent 4ddc661b01
commit c0155fd9dc
2 changed files with 4 additions and 2 deletions

View File

@ -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:

View File

@ -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)