Skip to content
Snippets Groups Projects

Resolve "Provide URL representation for every object"

Merged Jonathan Weth requested to merge 871-provide-url-representation-for-every-object into master
1 file
+ 5
1
Compare changes
  • Side-by-side
  • Inline
+ 5
1
@@ -1600,7 +1600,11 @@ class ObjectRepresentationView(View):
authenticators = list(ObjectAuthenticator.registered_objects_dict.keys())
self.authenticate(request, authenticators)
return JsonResponse({"id": self.object.id})
# FIXME generalize for all kinds of objects
res = {"id": self.object.id}
if hasattr(self.object, "user"):
res["user"] = {"username": self.object.user.username}
return JsonResponse(res)
def authenticate(self, request: HttpRequest, authenticators: list[str]) -> bool:
"""Authenticate the request against the given authenticators."""
Loading