diff --git a/beesgospel/migrations/0002_agenda_document.py b/beesgospel/migrations/0002_agenda_document.py index 7093470..ba6ce1a 100644 --- a/beesgospel/migrations/0002_agenda_document.py +++ b/beesgospel/migrations/0002_agenda_document.py @@ -37,6 +37,7 @@ class Migration(migrations.Migration): ), ), ], + options={'verbose_name': 'Agenda', 'verbose_name_plural': 'Agenda'}, ), migrations.CreateModel( name="Document", diff --git a/beesgospel/models.py b/beesgospel/models.py index 51695ea..f9af292 100644 --- a/beesgospel/models.py +++ b/beesgospel/models.py @@ -50,6 +50,10 @@ class Agenda(models.Model): ) ) + class Meta: + verbose_name = "Agenda" + verbose_name_plural = "Agenda" + def __str__(self): return f"{self.titre} {self.date_heure}" diff --git a/beesgospel/static/css/main.css b/beesgospel/static/css/main.css index cb920a3..66307cf 100644 --- a/beesgospel/static/css/main.css +++ b/beesgospel/static/css/main.css @@ -73,3 +73,8 @@ nav { .left-red { border-left: 2px solid red; } + +.prive { + background-image: linear-gradient(45deg, #333333 41.67%, #6b0c0c 41.67%, #6b0c0c 50%, #333333 50%, #333333 91.67%, #6b0c0c 91.67%, #6b0c0c 100%); + background-size: 33.94px 33.94px; +} diff --git a/beesgospel/views.py b/beesgospel/views.py index a96a2e1..e97bf0c 100644 --- a/beesgospel/views.py +++ b/beesgospel/views.py @@ -1,7 +1,21 @@ +from datetime import date, timedelta from django.contrib.auth.mixins import LoginRequiredMixin from django.views.generic import ListView, TemplateView -from .models import Membre +from .models import Agenda, Membre + + +class AgendaView(ListView): + model = Agenda + template_name = "agenda.html" + + def get_queryset(self): + qs = Agenda.objects.filter( + date_heure__gt=date.today() - timedelta(days=3), + ).order_by("date_heure") + if not self.request.user.is_authenticated: + qs = qs.filter(prive=False) + return qs class EspaceMembresView(LoginRequiredMixin, TemplateView): diff --git a/common/settings.py b/common/settings.py index dd44793..3876c66 100644 --- a/common/settings.py +++ b/common/settings.py @@ -96,11 +96,11 @@ AUTH_USER_MODEL = "beesgospel.User" # Internationalization # https://docs.djangoproject.com/en/5.2/topics/i18n/ -LANGUAGE_CODE = "fr" +LANGUAGE_CODE = "fr-ch" -TIME_ZONE = "UTC" +TIME_ZONE = "Europe/Zurich" -USE_I18N = False +USE_I18N = True USE_TZ = True diff --git a/common/urls.py b/common/urls.py index 2056d55..6896b7e 100644 --- a/common/urls.py +++ b/common/urls.py @@ -13,4 +13,5 @@ urlpatterns = [ path("contact/", TemplateView.as_view(template_name="contact.html"), name="contact"), path("membres/", views.EspaceMembresView.as_view(), name="membres"), path("membres/liste/", views.ListeMembresView.as_view(), name="liste-membres"), + path("agenda/", views.AgendaView.as_view(), name="agenda"), ] diff --git a/templates/admin/base_site.html b/templates/admin/base_site.html new file mode 100644 index 0000000..25f1cdb --- /dev/null +++ b/templates/admin/base_site.html @@ -0,0 +1,5 @@ +{% extends 'admin/base.html' %} + +{% block branding %} +
Administration du site beesgospel.ch
+{% endblock %} diff --git a/templates/agenda.html b/templates/agenda.html new file mode 100644 index 0000000..2d4dd35 --- /dev/null +++ b/templates/agenda.html @@ -0,0 +1,20 @@ +{% extends "base.html" %} + +{% block page_title %} - Agenda{% endblock %} + +{% block content %} +

Agenda des prochaines prestations de la chorale

+ +{% for item in object_list %} +
+
+
+ {{ item.date_heure|date:'D d F à H:i' }} +
+
{{ item.titre }}
+
+
{{ item.lieu }}
+
{{ item.infos }}
+
+{% endfor %} +{% endblock %} diff --git a/templates/base.html b/templates/base.html index 64d885f..8d423cc 100644 --- a/templates/base.html +++ b/templates/base.html @@ -3,7 +3,7 @@ - Le Gospel de l’Abeille - Bee's Gospel + Le Gospel de l’Abeille - Bee's Gospel{% block page_title %}{% endblock %} @@ -26,7 +26,7 @@ - + diff --git a/templates/membres/index.html b/templates/membres/index.html index 5bfeca4..65e3c25 100644 --- a/templates/membres/index.html +++ b/templates/membres/index.html @@ -5,7 +5,13 @@
{% csrf_token %}

Espace membres

-
- Liste des membres +
+ + {% if perms.beesgospel.change_agenda %} + + {% endif %} + {% if perms.beesgospel.change_document %} + + {% endif %}
{% endblock %}