Skip to content

Commit

Permalink
Added bartenders only event albums
Browse files Browse the repository at this point in the history
  • Loading branch information
AndersSeverinsen committed Dec 30, 2024
1 parent 438ae6f commit cbce7f9
Show file tree
Hide file tree
Showing 9 changed files with 222 additions and 167 deletions.
6 changes: 3 additions & 3 deletions gallery/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class Meta:
"publish_date",
"year",
"thumbnail",
"eventalbum",
"bartenderalbum",
"description",
"slug",
]
Expand All @@ -47,11 +47,11 @@ class AlbumAdmin(admin.ModelAdmin):
list_display = ("title", "year", "publish_date", "get_visibility_link")
ordering = [
"-year",
"eventalbum",
"bartenderalbum",
"-oldFolder",
"-publish_date",
] # Reverse of models.Album.ordering
list_filter = ("year", "eventalbum")
list_filter = ("year", "bartenderalbum")

# Form display of single album
inlines = [InlineBaseMediaAdmin]
Expand Down
32 changes: 32 additions & 0 deletions gallery/migrations/0006_auto_20241230_2158.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Generated by Django 3.2.25 on 2024-12-30 20:58

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
("gallery", "0005_alter_album_options"),
]

operations = [
migrations.AlterModelOptions(
name="album",
options={
"ordering": ["year", "bartenderalbum", "oldFolder", "-publish_date"]
},
),
migrations.RemoveField(
model_name="album",
name="eventalbum",
),
migrations.AddField(
model_name="album",
name="bartenderalbum",
field=models.BooleanField(
default=False,
help_text="Bartenderarrangementer er kun synlige for bartendere",
verbose_name="Bartenderarrangement",
),
),
]
8 changes: 6 additions & 2 deletions gallery/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
@python_2_unicode_compatible
class Album(models.Model):
class Meta:
ordering = ["year", "-eventalbum", "oldFolder", "-publish_date"]
ordering = ["year", "bartenderalbum", "oldFolder", "-publish_date"]
unique_together = (("year", "slug"),)

title = models.CharField(max_length=200, verbose_name=_("Titel"))
Expand All @@ -36,7 +36,11 @@ class Meta:
thumbnail = models.ImageField(
upload_to="galleries", blank=True, null=True, verbose_name=_("Thumbnail")
)
eventalbum = models.BooleanField(default=True, verbose_name=_("Arrangement"))
bartenderalbum = models.BooleanField(
default=False,
verbose_name=_("Bartenderarrangement"),
help_text=_("Bartenderarrangementer er kun synlige for bartendere"),
)
year = models.PositiveSmallIntegerField(default=get_year, verbose_name=_("Årgang"))
slug = models.SlugField(verbose_name=_("Kort titel"))
description = models.TextField(blank=True, verbose_name=_("Beskrivelse"))
Expand Down
8 changes: 6 additions & 2 deletions gallery/templates/gallery.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{% extends 'base.html' %}
{% load i18n %}
{% load static %}
{% load is_bartender %}

{% load bootstrap5 bootstrap_icons %}

Expand Down Expand Up @@ -32,14 +33,16 @@ <h4 class="panel-title">
<div>
<div class="col-xs-12">
{% for album, firstFile in albumSets %}
{% ifchanged album.eventalbum %}{% if not album.eventalbum %}
{% ifchanged album.bartenderalbum %}{% if album.bartenderalbum and user|is_bartender %}
</div>
<div class="col-xs-12">
<hr>
<h4>{% translate "Årets gang" %}:</h4>
<h4>{% translate "Bartenderarrangementer" %}:</h4>
</div>
<div class="col-xs-12">
{% endif %}{% endifchanged %}
{% if album.bartenderalbum and not user|is_bartender %}
{% else %}
<div class="col-xs-6 col-sm-4 col-md-3">
<a class="thumbnail" href="{% url 'album' year=album.year album_slug=album.slug %}">
<div class="thumbcap">
Expand All @@ -63,6 +66,7 @@ <h5>{{ album.title }}
</div>
</a>
</div> <!-- col-xs-6 thumb -->
{% endif %}
{% endfor %}
</div>
</div> <!-- row-->
Expand Down
Binary file modified locale/da/LC_MESSAGES/django.mo
Binary file not shown.
Loading

0 comments on commit cbce7f9

Please sign in to comment.