diff --git a/beesgospel/static/css/main.css b/beesgospel/static/css/main.css index 5349c36..db6d1d1 100644 --- a/beesgospel/static/css/main.css +++ b/beesgospel/static/css/main.css @@ -74,7 +74,12 @@ nav { border-left: 2px solid red; } -.date_agenda { background-color: #ddd; } +.agenda_line { margin-top: 7em !important; margin-right: 7em !important; } +@media (max-width: 767.98px) { + .agenda_line { margin-top: 1em !important; margin-right: 0 !important; } + .agenda_line > div { text-align: center !important; margin-top: 1em !important; } +} +.date_agenda { background-color: #ddd; text-decoration: none; } .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 4b729bd..b2a3d65 100644 --- a/beesgospel/views.py +++ b/beesgospel/views.py @@ -5,6 +5,18 @@ from django.views.generic import ListView, TemplateView from .models import Agenda, Document, Membre +class HomeView(TemplateView): + template_name="index.html" + + def get_context_data(self, **kwargs): + return { + **super().get_context_data(**kwargs), + "item": Agenda.objects.filter( + date_heure__date__gte=date.today(), prive=False, + ).order_by("date_heure").first(), + } + + class AgendaView(ListView): model = Agenda template_name = "agenda.html" diff --git a/common/urls.py b/common/urls.py index 83ccfa7..ff3fb51 100644 --- a/common/urls.py +++ b/common/urls.py @@ -7,7 +7,7 @@ from beesgospel import views urlpatterns = [ path("admin/", admin.site.urls), path("accounts/", include("django.contrib.auth.urls")), - path("", TemplateView.as_view(template_name="index.html"), name="home"), + path("", views.HomeView.as_view(), name="home"), path("v2", TemplateView.as_view(template_name="index2.html"), name="home"), path("presentation/", TemplateView.as_view(template_name="presentation.html"), name="presentation"), path("contact/", TemplateView.as_view(template_name="contact.html"), name="contact"), diff --git a/templates/index.html b/templates/index.html index 31f2940..4be7bc4 100644 --- a/templates/index.html +++ b/templates/index.html @@ -17,6 +17,18 @@ +
+
+ + {{ item.date_heure|date:'D d F à H:i' }} + +
+
+ + {{ item.titre }} ({{ item.lieu }}) + +
+