-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Possible solution for tags generation #7184
Merged
Merged
Changes from 15 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
d4e9b6e
add tag generation logic
dhaval-mehta bb339f4
FIX existing test cases
dhaval-mehta 44c1c25
add support for tag objects
dhaval-mehta a5eec91
improve tag generation from viewset name
dhaval-mehta ac145a4
add documentation for tags
dhaval-mehta 1baeb24
fix grammatical error
dhaval-mehta 8744470
remove extra line
dhaval-mehta 25f1425
remove APIView name check
dhaval-mehta 05d8a7b
add ExampleTagsViewSet view
dhaval-mehta 4b4f1c1
add test cases for tag generation
dhaval-mehta 9c3a632
minor improvement in documentation
dhaval-mehta b0f11cd
fix changes given by kevin-brown
dhaval-mehta 10cdd2b
improve documentation
dhaval-mehta ee97de3
improve documentation
dhaval-mehta 31a1eb1
add test case for tag generation from view-set
dhaval-mehta 56178ed
remove support for dict tags
dhaval-mehta 912f22a
change tag name style to url path style
dhaval-mehta cc2a8a5
remove test cases for tag objects
dhaval-mehta 8d3051d
add better example in comments
dhaval-mehta 4229234
sync documentation with implementation.
dhaval-mehta d77afd5
improve documentation
dhaval-mehta 22da477
change _get_tags to get_tags
dhaval-mehta 95831b5
add guidance for overriding get_tags method
dhaval-mehta f438f14
add test case for method override use case
dhaval-mehta 48c02dd
improve error message
dhaval-mehta 64a4828
remove tag generation from viewset
dhaval-mehta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -137,3 +137,14 @@ def get(self, *args, **kwargs): | |
url='http://localhost', uuid=uuid.uuid4(), ip4='127.0.0.1', ip6='::1', | ||
ip='192.168.1.1') | ||
return Response(serializer.data) | ||
|
||
|
||
class ExampleTagsViewSet(GenericViewSet): | ||
serializer_class = ExampleSerializer | ||
|
||
def retrieve(self, request, *args, **kwargs): | ||
serializer = self.get_serializer(integer=33, string='hello', regex='foo', decimal1=3.55, | ||
decimal2=5.33, email='[email protected]', | ||
url='http://localhost', uuid=uuid.uuid4(), ip4='127.0.0.1', ip6='::1', | ||
ip='192.168.1.1') | ||
return Response(serializer.data) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we ought to just use the path style as the default case?
I think that'd be more obvious, more consistent across a code base, and a little more simple.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I will implement the path style as the default case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think the default implementation should use the path. Folks can pass tags, or subclass for something cleverer.