Ajout d'une page à propos et d'un groupe éditeur contenu statique

This commit is contained in:
Jean-Marie Favreau 2024-04-17 12:14:43 +02:00
parent 5ba5732019
commit 4aed4889a7
5 changed files with 41 additions and 1 deletions

View File

@ -0,0 +1,29 @@
# Generated by Django 4.2.7 on 2024-04-17 10:12
from django.db import migrations
from django.contrib.auth.management import create_permissions
from django.contrib.auth.models import Group, Permission
def update_groups_permissions(apps, schema_editor):
# first add a missing role
user_roles = ["Static content editor"]
for name in user_roles:
Group.objects.create(name=name)
all_perms = Permission.objects.all()
# set permissions for moderators
editor_perms = [i for i in all_perms if i.content_type.app_label == 'agenda_culturel' and i.content_type.model in ['event', 'staticcontent']]
Group.objects.get(name="Static content editor").permissions.add(*editor_perms)
class Migration(migrations.Migration):
dependencies = [
('agenda_culturel', '0047_categorisationrule_loc_exact_and_more'),
]
operations = [
migrations.RunPython(update_groups_permissions),
]

View File

@ -45,6 +45,10 @@ $enable-responsive-typography: true;
body>footer {
text-align: center;
font-size: 90%;
p {
font-size: 80%;
}
}
.cat,

View File

@ -78,6 +78,9 @@
<div>
<a href="{% url 'mentions_legales' %}">Mentions légales</a>
</div>
<div>
<a href="{% url 'about' %}">À propos</a>
</div>
<div>
<a href="{% url 'contact' %}">Contact</a>
</div>

View File

@ -35,6 +35,7 @@ urlpatterns = [
path('rechercher', event_search, name='event_search'),
path('rechercher/complet/', event_search_full, name='event_search_full'),
path('mentions-legales', mentions_legales, name='mentions_legales'),
path('a-propos', about, name='about'),
path('contact', ContactMessageCreateView.as_view(), name='contact'),
path('contactmessages', contactmessages, name='contactmessages'),
path('contactmessage/<int:pk>', ContactMessageUpdateView.as_view(), name='contactmessage'),

View File

@ -141,10 +141,13 @@ class EventFilter(django_filters.FilterSet):
def mentions_legales(request):
context = { "title": "Mentions légales", "static_content": "mentions_legales", "url_path": reverse_lazy("mentions_legales") }
return render(request, 'agenda_culturel/page-single.html', context)
def about(request):
context = { "title": "À propos", "static_content": "about", "url_path": reverse_lazy("about") }
return render(request, 'agenda_culturel/page-single.html', context)
def home(request):
return week_view(request, home=True)