Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.

Problem: repository URI is mutable #3218

Merged
merged 1 commit into from Nov 13, 2017
Merged

Conversation

dkliban
Copy link
Member

@dkliban dkliban commented Nov 9, 2017

Solution: use repository id in the URL instead of name

This patch switches repository URI from /api/v3/repositories/<name>/ to
/api/v3/repositories/<pk>/.

closes #3101
https://pulp.plan.io/issues/3101

@dkliban dkliban force-pushed the repository-uri branch 2 times, most recently from 4b7f4fd to 0d8d6a2 Compare November 9, 2017 18:34
@dralley dralley added the 3.0 label Nov 10, 2017
@@ -23,7 +23,7 @@ class HrefWritableRepositoryRelatedField(serializers.HyperlinkedRelatedField):
read_only should passed as a kwarg to this field.
"""
view_name = 'repositories-detail'
lookup_field = 'name'
lookup_field = 'pk'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you need to specify pk as a lookup_field explicitly? I think it's a default.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you are correct. I'll test without it and see if it still works.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removing the lookup_field seems to work. however, i am not sure what other places in this PR could use a similar change.

Copy link
Member

@goosemania goosemania left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, @dkliban !
Changes look good to me. Please, make sure team is on board with this change before merging it.

Solution: use repository id in the URL instead of name

This patch switches repository URI from /api/v3/repositories/<name>/ to
/api/v3/repositories/<pk>/.

closes pulp#3101
https://pulp.plan.io/issues/3101
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants