core: return none when application has no launch URL and none could be guessed

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2021-04-08 22:59:11 +02:00
parent dbc75428a0
commit 7d0e7bcf75
1 changed files with 4 additions and 2 deletions

View File

@ -1,4 +1,6 @@
"""Application API Views"""
from typing import Optional
from django.core.cache import cache
from django.db.models import QuerySet
from django.http.response import HttpResponseBadRequest
@ -35,9 +37,9 @@ class ApplicationSerializer(ModelSerializer):
launch_url = SerializerMethodField()
provider = ProviderSerializer(source="get_provider", required=False)
def get_launch_url(self, instance: Application) -> str:
def get_launch_url(self, instance: Application) -> Optional[str]:
"""Get generated launch URL"""
return instance.get_launch_url() or ""
return instance.get_launch_url()
class Meta: