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:
parent
dbc75428a0
commit
7d0e7bcf75
|
@ -1,4 +1,6 @@
|
||||||
"""Application API Views"""
|
"""Application API Views"""
|
||||||
|
from typing import Optional
|
||||||
|
|
||||||
from django.core.cache import cache
|
from django.core.cache import cache
|
||||||
from django.db.models import QuerySet
|
from django.db.models import QuerySet
|
||||||
from django.http.response import HttpResponseBadRequest
|
from django.http.response import HttpResponseBadRequest
|
||||||
|
@ -35,9 +37,9 @@ class ApplicationSerializer(ModelSerializer):
|
||||||
launch_url = SerializerMethodField()
|
launch_url = SerializerMethodField()
|
||||||
provider = ProviderSerializer(source="get_provider", required=False)
|
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"""
|
"""Get generated launch URL"""
|
||||||
return instance.get_launch_url() or ""
|
return instance.get_launch_url()
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
||||||
|
|
Reference in a new issue