core: make request in context optional for Applications API

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>

#3482
This commit is contained in:
Jens Langhammer 2022-08-28 15:59:34 +02:00
parent c3c8cbf7ef
commit 5886688fae
1 changed files with 3 additions and 1 deletions

View File

@ -50,6 +50,8 @@ class ApplicationSerializer(ModelSerializer):
def get_launch_url(self, app: Application) -> Optional[str]:
"""Allow formatting of launch URL"""
user = None
if "request" in self.context:
user = self.context["request"].user
return app.get_launch_url(user)