Commit deaeb6c0 authored by Samuel GAIST's avatar Samuel GAIST

[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 6826a8d5
......@@ -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("/"),
),
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment