Skip to content

Commit e095a48

Browse files
committed
APIv3: remove source= field when it's the same as field's name
``` AssertionError: It is redundant to specify `source='last_build'` on field 'BuildSerializer' in serializer 'VersionSerializer' ```
1 parent 15ea399 commit e095a48

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

readthedocs/api/v3/serializers.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ class Meta:
173173
]
174174

175175
expandable_fields = {
176-
'config': (BuildConfigSerializer, {'source': 'config'})
176+
'config': (BuildConfigSerializer,)
177177
}
178178

179179
def get_finished(self, obj):
@@ -275,7 +275,7 @@ class Meta:
275275

276276
expandable_fields = {
277277
'last_build': (
278-
BuildSerializer, {'source': 'last_build'}
278+
BuildSerializer,
279279
)
280280
}
281281

@@ -569,12 +569,11 @@ class Meta:
569569
]
570570

571571
expandable_fields = {
572+
# NOTE: this has to be a Model method, can't be a
573+
# ``SerializerMethodField`` as far as I know
572574
'active_versions': (
573575
VersionSerializer,
574576
{
575-
# NOTE: this has to be a Model method, can't be a
576-
# ``SerializerMethodField`` as far as I know
577-
'source': 'active_versions',
578577
'many': True,
579578
}
580579
)
@@ -954,7 +953,7 @@ class Meta:
954953
RemoteOrganizationSerializer, {'source': 'organization'}
955954
),
956955
'projects': (
957-
ProjectSerializer, {'source': 'projects', 'many': True}
956+
ProjectSerializer, {'many': True}
958957
)
959958
}
960959

0 commit comments

Comments
 (0)