diff --git a/fet2020/gallery/models.py b/fet2020/gallery/models.py
index 512919a9..94ae6335 100644
--- a/fet2020/gallery/models.py
+++ b/fet2020/gallery/models.py
@@ -20,11 +20,13 @@ class Album(models.Model):
)
description = models.TextField(null=True, blank=True)
+ DRAFT = "10"
+ PUBLIC = "20"
STATUS = (
- ("10", "DRAFT"),
- ("20", "PUBLIC"),
+ (DRAFT, "DRAFT"),
+ (PUBLIC, "PUBLIC"),
)
- status = models.CharField(max_length=2, choices=STATUS, default="10")
+ status = models.CharField(max_length=2, choices=STATUS, default=DRAFT)
event_date = models.DateField(
verbose_name="Event Datum", null=True, blank=True, default=timezone.now
diff --git a/fet2020/gallery/views.py b/fet2020/gallery/views.py
index 0ec6255b..8d63069b 100644
--- a/fet2020/gallery/views.py
+++ b/fet2020/gallery/views.py
@@ -16,8 +16,8 @@ def index(request):
if request.user.is_authenticated:
albums = deque(Album.objects.all().order_by("-event_date"))
else:
- # show only PUBLIC albums ("20" -> PUBLIC).
- albums = deque(Album.objects.filter(status="20").order_by("-event_date"))
+ # show only PUBLIC albums.
+ albums = deque(Album.objects.filter(status=Album.PUBLIC).order_by("-event_date"))
for album in list(albums):
img_list = get_image_list(album.folder_name)
@@ -35,7 +35,7 @@ def index(request):
album.thumbnail = img_list[value]["thumb_url"]
else:
# empty album is set to DRAFT.
- album.status = "10"
+ album.status = Album.DRAFT
if request.user.is_authenticated:
for folder in get_folder_list():
diff --git a/fet2020/templates/gallery/album.html b/fet2020/templates/gallery/album.html
index 04c427a1..64b150d2 100644
--- a/fet2020/templates/gallery/album.html
+++ b/fet2020/templates/gallery/album.html
@@ -35,7 +35,7 @@
{% if album.event_date %}
Datum: {{ album.event_date }}
{% endif %}
- {% if album.status == "10" %}
+ {% if album.status == album.DRAFT %}
DRAFT
{% endif %}
{% if album.description %}
diff --git a/fet2020/templates/gallery/index.html b/fet2020/templates/gallery/index.html
index b95f5a4e..1ba0ed32 100644
--- a/fet2020/templates/gallery/index.html
+++ b/fet2020/templates/gallery/index.html
@@ -14,7 +14,7 @@