Skip to content

Commit

Permalink
Problem: publication's distributions are full URLs
Browse files Browse the repository at this point in the history
Solution: use DetailRelatedField instead of HyperlinkedRelatedField

The serializer was using the wrong type of field for serializing the Publication's distrubtions field.

fixes: #4590
https://pulp.plan.io/issues/4590
  • Loading branch information
dkliban committed Apr 5, 2019
1 parent 571dc69 commit 178d967
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pulpcore/app/serializers/publication.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,13 @@ class PublicationSerializer(ModelSerializer):
help_text=_('The publisher that created this publication.'),
queryset=models.Publisher.objects.all()
)
_distributions = serializers.HyperlinkedRelatedField(
_distributions = DetailRelatedField(
help_text=_('This publication is currently being served as'
'defined by these distributions.'),
many=True,
read_only=True,
view_name='distributions-detail',
queryset=models.BaseDistribution.objects.all()
)
repository_version = NestedRelatedField(
view_name='versions-detail',
Expand Down

0 comments on commit 178d967

Please sign in to comment.