Skip to content
Snippets Groups Projects
Commit 8d69b9d0 authored by Samuel GAIST's avatar Samuel GAIST Committed by Samuel GAIST
Browse files

[common][api] Simplify reverse args creation for view URL

The items needed are the same as provided by the fullname method.
This allows to integrate the Experiment creation serializer
parent 0cea5f07
No related branches found
No related tags found
No related merge requests found
This commit is part of merge request !327. Comments created here will be created in the context of that merge request.
......@@ -171,10 +171,6 @@ class ListCreateBaseView(
else:
return BadRequestResponse(serializer.errors)
html_view_args = [db_object.name, db_object.version]
if hasattr(db_object, "author"):
html_view_args.insert(0, db_object.author.username)
result = {
"name": db_object.name,
"full_name": db_object.fullname(),
......@@ -182,7 +178,8 @@ class ListCreateBaseView(
+ db_object.fullname()
+ "/",
"object_view": reverse(
"{}:view".format(self.namespace.split("_")[1]), args=html_view_args
"{}:view".format(self.namespace.split("_")[1]),
args=db_object.fullname().split("/"),
),
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment