Skip to content

Commit

Permalink
refactor: change donation twint qr-code
Browse files Browse the repository at this point in the history
  • Loading branch information
ohrstrom committed Jan 8, 2024
1 parent a437674 commit cc24144
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 12 deletions.
5 changes: 4 additions & 1 deletion obr_core/broadcast/models/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ def get_absolute_url(self):

@cached_property
def image(self):
return self.images.latest()
try:
return self.images.latest()
except self.images.model.DoesNotExist:
return None

@cached_property
def is_former(self):
Expand Down
18 changes: 10 additions & 8 deletions obr_core/catalog/api/serializers/playlist.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
from api_extra.serializers import CTUIDModelSerializer, DurationInSecondsSerializer
from api_extra.serializers import (
CTUIDModelSerializer,
CTUIDSerializer,
DurationInSecondsSerializer,
)
from broadcast.models.editor import Editor
from broadcast.models.emission import Emission
from catalog.api.serializers import MediaSerializer
from catalog.models import Playlist, PlaylistImage, PlaylistMedia, Series
from catalog.models import Playlist, PlaylistImage, PlaylistMedia
from image.api.serializers import BaseImageSerializer, ImageSerializer
from rest_flex_fields.serializers import FlexFieldsSerializerMixin
from rest_framework import serializers
Expand Down Expand Up @@ -79,20 +83,17 @@ class Meta(CTUIDModelSerializer.Meta):


class PlaylistSeriesSerializer(
CTUIDModelSerializer,
serializers.ModelSerializer,
CTUIDSerializer,
serializers.Serializer,
):
name = serializers.CharField(
read_only=True,
)
episode = serializers.CharField(
episode = serializers.IntegerField(
read_only=True,
source="series_episode",
default="",
)

class Meta:
model = Series
fields = [
"ct",
"uid",
Expand Down Expand Up @@ -128,6 +129,7 @@ class PlaylistSerializer(
allow_null=True,
)
series = PlaylistSeriesSerializer(
source="series_dict",
read_only=True,
)

Expand Down
5 changes: 4 additions & 1 deletion obr_core/catalog/models/artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ def get_absolute_url(self):

@cached_property
def image(self):
return self.images.latest()
try:
return self.images.latest()
except self.images.model.DoesNotExist:
return None

def sync_data(self, *args, **kwargs):
return sync_artist(self, *args, **kwargs)
Expand Down
6 changes: 5 additions & 1 deletion obr_core/catalog/models/playlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,10 @@ def title_display(self):

@cached_property
def image(self):
return self.images.latest()
try:
return self.images.latest()
except self.images.model.DoesNotExist:
return None

@property
# NOTE: rethink this implementation (currently not in use)
Expand Down Expand Up @@ -132,6 +135,7 @@ def series_dict(self):
# NOTE: maybe this could be handled in a more elegant way.
if self.series:
return {
"ct": "catalog.series",
"uid": self.series.uid,
"name": self.series.name,
"episode": self.series_episode,
Expand Down
5 changes: 4 additions & 1 deletion obr_core/catalog/models/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,10 @@ def get_absolute_url(self):

@cached_property
def image(self):
return self.images.latest()
try:
return self.images.latest()
except self.images.model.DoesNotExist:
return None

@cached_property
def num_media(self):
Expand Down
1 change: 1 addition & 0 deletions obr_core/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,viewport-fit=cover">
<meta id="apple-itunes-app" name="apple-itunes-app" content="app-id=1643695398">
<meta id="theme-color" name="theme-color" content="rgb({% if color %}{{ color|join:',' }}{% else %}200,200,200{% endif %})">
<link rel="dns-prefetch" href="https://fonts.googleapis.com/">
<link rel="icon" type="image/png" href="{% static 'assets/manifest/icon-triangle-white.png' %}">
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified obr_ui/assets/pages/donate/twint-qr-code.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit cc24144

Please sign in to comment.