ajout d'un formulaire de contact

This commit is contained in:
Jean-Marie Favreau 2023-12-16 19:37:13 +01:00
parent 7a55525408
commit 3e8f28422f
8 changed files with 303 additions and 184 deletions

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: agenda_culturel\n" "Project-Id-Version: agenda_culturel\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-10-29 21:20+0000\n" "POT-Creation-Date: 2023-12-16 18:21+0000\n"
"PO-Revision-Date: 2023-10-29 14:16+0000\n" "PO-Revision-Date: 2023-10-29 14:16+0000\n"
"Last-Translator: Jean-Marie Favreau <jeanmarie.favreau@free.fr>\n" "Last-Translator: Jean-Marie Favreau <jeanmarie.favreau@free.fr>\n"
"Language-Team: Jean-Marie Favreau <jeanmarie.favreau@free.fr>\n" "Language-Team: Jean-Marie Favreau <jeanmarie.favreau@free.fr>\n"
@ -17,258 +17,305 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
#: agenda_culturel/models.py:25 #: agenda_culturel/forms.py:36
msgid "The start date cannot be earler than today."
msgstr "La date de début ne peut pas être avant aujourd'hui."
#: agenda_culturel/forms.py:46
msgid "The end date must be after the start date."
msgstr "La date de fin doit être après la date de début."
#: agenda_culturel/forms.py:48
msgid "The end date cannot be earler than today."
msgstr "La date de fin ne peut pas être avant aujourd'hui."
#: agenda_culturel/forms.py:63
msgid "The end time cannot be earlier than the start time."
msgstr "L'heure de fin ne peut pas être avant l'heure de début."
#: agenda_culturel/models.py:19 agenda_culturel/models.py:48
#: agenda_culturel/models.py:179
msgid "Name" msgid "Name"
msgstr "Nom" msgstr "Nom"
#: agenda_culturel/models.py:25 #: agenda_culturel/models.py:19 agenda_culturel/models.py:48
msgid "Category name" msgid "Category name"
msgstr "Nom de la catégorie" msgstr "Nom de la catégorie"
#: agenda_culturel/models.py:26 #: agenda_culturel/models.py:20
msgid "Content"
msgstr "Contenu"
#: agenda_culturel/models.py:20
msgid "Text as shown to the visitors"
msgstr "Text tel que présenté aux visiteureuses"
#: agenda_culturel/models.py:21
msgid "URL path"
msgstr ""
#: agenda_culturel/models.py:21
msgid "URL path where the content is included."
msgstr ""
#: agenda_culturel/models.py:49
msgid "Alternative Name" msgid "Alternative Name"
msgstr "Nom alternatif" msgstr "Nom alternatif"
#: agenda_culturel/models.py:26 #: agenda_culturel/models.py:49
msgid "Alternative name used with a time period" msgid "Alternative name used with a time period"
msgstr "Nom alternatif utilisé avec une période de temps" msgstr "Nom alternatif utilisé avec une période de temps"
#: agenda_culturel/models.py:27 #: agenda_culturel/models.py:50
#, fuzzy
#| msgid "Short title"
msgid "Short name" msgid "Short name"
msgstr "Nom court" msgstr "Nom court"
#: agenda_culturel/models.py:27 #: agenda_culturel/models.py:50
msgid "Short name of the category" msgid "Short name of the category"
msgstr "Nom court de la catégorie" msgstr "Nom court de la catégorie"
#: agenda_culturel/models.py:28 #: agenda_culturel/models.py:51
msgid "Color" msgid "Color"
msgstr "Couleur" msgstr "Couleur"
#: agenda_culturel/models.py:28 #: agenda_culturel/models.py:51
msgid "Color used as background for the category" msgid "Color used as background for the category"
msgstr "Couleur utilisée comme fond de la catégorie" msgstr "Couleur utilisée comme fond de la catégorie"
#: agenda_culturel/models.py:53 agenda_culturel/models.py:70 #: agenda_culturel/models.py:88 agenda_culturel/models.py:105
msgid "Category" msgid "Category"
msgstr "Catégorie" msgstr "Catégorie"
#: agenda_culturel/models.py:54 #: agenda_culturel/models.py:89
msgid "Categories" msgid "Categories"
msgstr "Catégories" msgstr "Catégories"
#: agenda_culturel/models.py:59 #: agenda_culturel/models.py:94
msgid "Published" msgid "Published"
msgstr "Publié" msgstr "Publié"
#: agenda_culturel/models.py:60 #: agenda_culturel/models.py:95
msgid "Trash"
msgstr "Corbeille"
#: agenda_culturel/models.py:61
msgid "Draft" msgid "Draft"
msgstr "Brouillon" msgstr "Brouillon"
#: agenda_culturel/models.py:66 #: agenda_culturel/models.py:96
msgid "Trash"
msgstr "Corbeille"
#: agenda_culturel/models.py:101
msgid "Title" msgid "Title"
msgstr "Titre" msgstr "Titre"
#: agenda_culturel/models.py:66 #: agenda_culturel/models.py:101
msgid "Short title" msgid "Short title"
msgstr "Titre court" msgstr "Titre court"
#: agenda_culturel/models.py:68 #: agenda_culturel/models.py:103
msgid "Status" msgid "Status"
msgstr "Status" msgstr "Status"
#: agenda_culturel/models.py:70 #: agenda_culturel/models.py:105
msgid "Category of the event" msgid "Category of the event"
msgstr "Catégorie de l'événement" msgstr "Catégorie de l'événement"
#: agenda_culturel/models.py:72 #: agenda_culturel/models.py:107
msgid "Day of the event" msgid "Day of the event"
msgstr "Date de l'événement" msgstr "Date de l'événement"
#: agenda_culturel/models.py:73 #: agenda_culturel/models.py:108
msgid "Starting time" msgid "Starting time"
msgstr "Heure de début" msgstr "Heure de début"
#: agenda_culturel/models.py:75 #: agenda_culturel/models.py:110
msgid "End day of the event" msgid "End day of the event"
msgstr "Fin de l'événement" msgstr "Fin de l'événement"
#: agenda_culturel/models.py:75 #: agenda_culturel/models.py:110
msgid "End day of the event, only required if different from the start day." msgid "End day of the event, only required if different from the start day."
msgstr "" msgstr ""
"Date de fin de l'événement, uniquement nécessaire s'il est différent du " "Date de fin de l'événement, uniquement nécessaire s'il est différent du "
"premier jour de l'événement" "premier jour de l'événement"
#: agenda_culturel/models.py:76 #: agenda_culturel/models.py:111
msgid "Final time" msgid "Final time"
msgstr "Heure de fin" msgstr "Heure de fin"
#: agenda_culturel/models.py:78 #: agenda_culturel/models.py:113
msgid "Location" msgid "Location"
msgstr "Localisation" msgstr "Localisation"
#: agenda_culturel/models.py:78 #: agenda_culturel/models.py:113
msgid "Address of the event" msgid "Address of the event"
msgstr "Adresse de l'événement" msgstr "Adresse de l'événement"
#: agenda_culturel/models.py:80 #: agenda_culturel/models.py:115
msgid "Description" msgid "Description"
msgstr "Description" msgstr "Description"
#: agenda_culturel/models.py:80 #: agenda_culturel/models.py:115
msgid "General description of the event" msgid "General description of the event"
msgstr "Description générale de l'événement" msgstr "Description générale de l'événement"
#: agenda_culturel/models.py:82 #: agenda_culturel/models.py:117
msgid "Illustration"
msgstr "Illustration"
#: agenda_culturel/models.py:82
msgid "URL of the illustration image"
msgstr "URL de l'image illustrative"
#: agenda_culturel/models.py:83
msgid "Illustration description"
msgstr "Description de l'illustration"
#: agenda_culturel/models.py:83
msgid "Alternative text used by screen readers for the image"
msgstr "Texte alternatif utiliser par les lecteurs d'écrans pour l'image"
#: agenda_culturel/models.py:85
msgid "URLs"
msgstr "URLs"
#: agenda_culturel/models.py:85
msgid "List of all the urls where this event can be found."
msgstr "Liste de toutes les urls où l'événement peut être trouvé."
#: agenda_culturel/models.py:87
msgid "Tags"
msgstr "Étiquettes"
#: agenda_culturel/models.py:87
msgid "A list of tags that describe the event."
msgstr "Une liste d'étiquettes décrivant l'événement"
#: agenda_culturel/models.py:96
msgid "Event"
msgstr "Événement"
#: agenda_culturel/models.py:97
msgid "Events"
msgstr "Événements"
#: agenda_culturel/models.py:101
msgid "URL"
msgstr "URL"
#: agenda_culturel/models.py:101
msgid "URL where this event can be found."
msgstr "URL où l'événement peut être trouvé."
#: agenda_culturel/models.py:105
msgid "Event submission form"
msgstr "Formulaire de proposition d'événement"
#: agenda_culturel/models.py:106
msgid "Event submissions forms"
msgstr "Formulaires de proposition d'événement"
#: agenda_culturel/settings/base.py:122
msgid "English"
msgstr "anglais"
#: agenda_culturel/settings/base.py:123
msgid "French"
msgstr "français"
msgid "this week"
msgstr "cette semaine"
msgid "this weekend"
msgstr "ce week-end"
msgid "next week"
msgstr "la semaine prochaine"
msgid "next weekend"
msgstr "le week-end prochain"
msgid "this month"
msgstr "ce mois-ci"
msgid "next month"
msgstr "le mois prochain"
msgid "Add another"
msgstr "Ajouter une autre"
msgid "Search"
msgstr "Rechercher"
msgid "Text as shown to the visitors"
msgstr "Text tel que présenté aux visiteureuses"
msgid "Content"
msgstr "Contenu"
msgid "Illustration (local image)" msgid "Illustration (local image)"
msgstr "Illustration (image locale)" msgstr "Illustration (image locale)"
#: agenda_culturel/models.py:117
msgid "Illustration image stored in the agenda server" msgid "Illustration image stored in the agenda server"
msgstr "Image d'illustration stockée sur le serveur de l'agenda" msgstr "Image d'illustration stockée sur le serveur de l'agenda"
msgid "The event has been successfully modified." #: agenda_culturel/models.py:119
msgstr "L'événement a été modifié avec succès." msgid "Illustration"
msgstr "Illustration"
msgid "The event has been successfully deleted." #: agenda_culturel/models.py:119
msgstr "L'événement a été supprimé avec succès" msgid "URL of the illustration image"
msgstr "URL de l'image illustrative"
msgid "The URL has been submitted and the associated event will be integrated in the agenda after validation." #: agenda_culturel/models.py:120
msgstr "L'adresse a été soumise et l'événement associé sera prochainement intégré à l'agenda après validation." msgid "Illustration description"
msgstr "Description de l'illustration"
#: agenda_culturel/models.py:120
msgid "Alternative text used by screen readers for the image"
msgstr "Texte alternatif utiliser par les lecteurs d'écrans pour l'image"
#: agenda_culturel/models.py:122
msgid "URLs"
msgstr "URLs"
#: agenda_culturel/models.py:122
msgid "List of all the urls where this event can be found."
msgstr "Liste de toutes les urls où l'événement peut être trouvé."
#: agenda_culturel/models.py:124
msgid "Tags"
msgstr "Étiquettes"
#: agenda_culturel/models.py:124
msgid "A list of tags that describe the event."
msgstr "Une liste d'étiquettes décrivant l'événement"
#: agenda_culturel/models.py:149
msgid "Event"
msgstr "Événement"
#: agenda_culturel/models.py:150
msgid "Events"
msgstr "Événements"
#: agenda_culturel/models.py:178
msgid "Subject"
msgstr "Sujet"
#: agenda_culturel/models.py:178
msgid "The subject of your message"
msgstr "Sujet de votre message"
#: agenda_culturel/models.py:179
msgid "Your name"
msgstr "Votre nom"
#: agenda_culturel/models.py:180
msgid "Email address"
msgstr "Adresse email"
#: agenda_culturel/models.py:180
msgid "Your email address"
msgstr "Votre adresse email"
#: agenda_culturel/models.py:181
msgid "Message"
msgstr "Message"
#: agenda_culturel/models.py:181
msgid "Your message"
msgstr "Votre message"
#: agenda_culturel/models.py:185
msgid "Closed"
msgstr "Fermé"
#: agenda_culturel/models.py:185
msgid "this message has been processed and no longer needs to be handled"
msgstr "Ce message a été traité et ne nécessite plus d'être pris en charge"
#: agenda_culturel/models.py:186
msgid "Comments"
msgstr "Commentaires"
#: agenda_culturel/models.py:186
msgid "Comments on the message from the moderation team"
msgstr "Commentaires sur ce message par l'équipe de modération"
#: agenda_culturel/settings/base.py:128
msgid "English"
msgstr "anglais"
#: agenda_culturel/settings/base.py:129
msgid "French"
msgstr "français"
#: agenda_culturel/views.py:182
msgid "The static content has been successfully updated." msgid "The static content has been successfully updated."
msgstr "Le contenu statique a été modifié avec succès." msgstr "Le contenu statique a été modifié avec succès."
msgid "The end date must be after the start date." #: agenda_culturel/views.py:191
msgstr "La date de fin doit être après la date de début." msgid "Your message has been sent successfully."
msgstr "L'événement a été supprimé avec succès"
msgid "The end date cannot be earler than today." #: agenda_culturel/views.py:197
msgstr "La date de fin ne peut pas être avant aujourd'hui." msgid "The event has been successfully modified."
msgstr "L'événement a été modifié avec succès."
msgid "The start date cannot be earler than today." #: agenda_culturel/views.py:208
msgstr "La date de début ne peut pas être avant aujourd'hui." msgid "The event has been successfully deleted."
msgstr "L'événement a été supprimé avec succès"
msgid "The end time cannot be earlier than the start time." #: agenda_culturel/views.py:246
msgstr "L'heure de fin ne peut pas être avant l'heure de début." msgid "The event is saved."
msgstr "L'événement est enregistré."
msgid "The event has been submitted and will be published as soon as it has been validated by the moderation team." #: agenda_culturel/views.py:249
msgstr "L'événement a été soumis et sera publié dès qu'il aura été validé par l'équipe de modération." msgid ""
"The event has been submitted and will be published as soon as it has been "
"validated by the moderation team."
msgstr ""
"L'événement a été soumis et sera publié dès qu'il aura été validé par "
"l'équipe de modération."
msgid "The URL has been taken into account, and the associated event will be available in a few moments for validation." #: agenda_culturel/views.py:279
msgstr "L'URL a été prise en compte, et l'événement associé sera disponible dans quelques instants pour validation." msgid ""
"The event has been successfully extracted, and you can now submit it after "
"modifying it if necessary."
msgstr ""
"L'événement a été extrait avec succès, vous pouvez maintenant le soumettre "
"après l'avoir modifié au besoin."
msgid "The event has been successfully extracted, and you can now submit it after modifying it if necessary." #: agenda_culturel/views.py:283
msgstr "L'événement a été extrait avec succès, vous pouvez maintenant le soumettre après l'avoir modifié au besoin." msgid ""
"Unable to extract an event from the proposed URL. Please use the form below "
msgid "Unable to extract an event from the proposed URL. Please use the form below to submit the event." "to submit the event."
msgstr "Impossible d'extraire un événement depuis l'URL proposée. Veuillez utiliser le formulaire ci-dessous pour soumettre l'événement." msgstr ""
"Impossible d'extraire un événement depuis l'URL proposée. Veuillez utiliser "
"le formulaire ci-dessous pour soumettre l'événement."
#: agenda_culturel/views.py:292
msgid "This URL has already been submitted, and you can find the event below." msgid "This URL has already been submitted, and you can find the event below."
msgstr "Cette URL a déjà été soumise, et vous trouverez l'événement ci-dessous." msgstr "Cette URL a déjà été soumise, et vous trouverez l'événement ci-dessous."
#: agenda_culturel/views.py:296
msgid ""
"This URL has already been submitted, but has not been selected for "
"publication by the moderation team."
msgstr ""
"Cette URL a déjà été soumise, mais n'a pas été retenue par l'équipe de "
"modération pour la publication."
#: agenda_culturel/views.py:298
msgid "This URL has already been submitted and is awaiting moderation." msgid "This URL has already been submitted and is awaiting moderation."
msgstr "Cette URL a déjà été soumise, et est en attente de modération" msgstr "Cette URL a déjà été soumise, et est en attente de modération"
msgid "This URL has already been submitted, but has not been selected for publication by the moderation team." #: agenda_culturel/views.py:329
msgstr "Cette URL a déjà été soumise, mais n'a pas été retenue par l'équipe de modération pour la publication." msgid "Search"
msgstr "Rechercher"
msgid "The event is saved."
msgstr "L'événement est enregistré."

View File

@ -0,0 +1,26 @@
# Generated by Django 4.2.7 on 2023-12-16 18:06
import ckeditor.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('agenda_culturel', '0006_alter_event_status'),
]
operations = [
migrations.CreateModel(
name='ContactMessage',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('subject', models.CharField(help_text='The subject of your message', max_length=512, verbose_name='Subject')),
('name', models.CharField(blank=True, help_text='Your name', max_length=512, null=True, verbose_name='Name')),
('author', models.EmailField(blank=True, help_text='Your email address', max_length=254, null=True, verbose_name='Email address')),
('date', models.DateTimeField(auto_now_add=True)),
('closed', models.BooleanField(default=False, help_text='this message has been processed and no longer needs to be handled', verbose_name='Closed')),
('message', ckeditor.fields.RichTextField(default='', help_text='Comments on the message from the modaration team', verbose_name='Comments')),
],
),
]

View File

@ -0,0 +1,28 @@
# Generated by Django 4.2.7 on 2023-12-16 18:33
import ckeditor.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('agenda_culturel', '0007_contactmessage'),
]
operations = [
migrations.RemoveField(
model_name='contactmessage',
name='author',
),
migrations.AddField(
model_name='contactmessage',
name='email',
field=models.EmailField(blank=True, help_text='Your email address', max_length=254, null=True, verbose_name='Email address'),
),
migrations.AlterField(
model_name='contactmessage',
name='message',
field=ckeditor.fields.RichTextField(default='', help_text='Comments on the message from the moderation team', verbose_name='Comments'),
),
]

View File

@ -0,0 +1,24 @@
# Generated by Django 4.2.7 on 2023-12-16 18:35
import ckeditor.fields
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('agenda_culturel', '0008_remove_contactmessage_author_contactmessage_email_and_more'),
]
operations = [
migrations.AddField(
model_name='contactmessage',
name='comments',
field=ckeditor.fields.RichTextField(default='', help_text='Comments on the message from the moderation team', verbose_name='Comments'),
),
migrations.AlterField(
model_name='contactmessage',
name='message',
field=ckeditor.fields.RichTextField(help_text='Your message', verbose_name='Message'),
),
]

View File

@ -172,3 +172,16 @@ class Event(models.Model):
def modified(self): def modified(self):
return abs((self.modified_date - self.created_date).total_seconds()) > 1 return abs((self.modified_date - self.created_date).total_seconds()) > 1
class ContactMessage(models.Model):
subject = models.CharField(verbose_name=_('Subject'), help_text=_('The subject of your message'), max_length=512)
name = models.CharField(verbose_name=_('Name'), help_text=_('Your name'), max_length=512, blank=True, null=True)
email = models.EmailField(verbose_name=_('Email address'), help_text=_('Your email address'), max_length=254, blank=True, null=True)
message = RichTextField(verbose_name=_('Message'), help_text=_('Your message'))
date = models.DateTimeField(auto_now_add=True)
closed = models.BooleanField(verbose_name=_('Closed'), help_text=_('this message has been processed and no longer needs to be handled'), default=False)
comments = RichTextField(verbose_name=_('Comments'), help_text=_('Comments on the message from the moderation team'), default="")

View File

@ -70,7 +70,7 @@
<a href="{% url 'mentions_legales' %}">Mentions légales</a> <a href="{% url 'mentions_legales' %}">Mentions légales</a>
</div> </div>
<div> <div>
Contact <a href="{% url 'contact' %}">Contact</a>
</div> </div>
<div> <div>
<a href="{% url 'add_event' %}">Ajouter un événement</a> <a href="{% url 'add_event' %}">Ajouter un événement</a>

View File

@ -30,7 +30,8 @@ urlpatterns = [
path("static-content/<int:pk>/edit", StaticContentUpdateView.as_view(), name="edit_static_content"), path("static-content/<int:pk>/edit", StaticContentUpdateView.as_view(), name="edit_static_content"),
path('rechercher', event_search, name='event_search'), path('rechercher', event_search, name='event_search'),
path('rechercher/complet/', event_search_full, name='event_search_full'), path('rechercher/complet/', event_search_full, name='event_search_full'),
path('mentions-legales', mentions_legales, name='mentions_legales') path('mentions-legales', mentions_legales, name='mentions_legales'),
path('contact', ContactMessageCreateView.as_view(), name='contact')
] ]
if settings.DEBUG: if settings.DEBUG:

View File

@ -13,7 +13,7 @@ import urllib
from .forms import EventSubmissionForm, EventForm from .forms import EventSubmissionForm, EventForm
from .models import Event, Category, StaticContent from .models import Event, Category, StaticContent, ContactMessage
from django.utils import timezone from django.utils import timezone
from enum import StrEnum from enum import StrEnum
from datetime import date, timedelta from datetime import date, timedelta
@ -97,6 +97,7 @@ def mentions_legales(request):
context = { "title": "Mentions légales", "static_content": "mentions_legales", "url_path": reverse_lazy("mentions_legales") } context = { "title": "Mentions légales", "static_content": "mentions_legales", "url_path": reverse_lazy("mentions_legales") }
return render(request, 'agenda_culturel/page-single.html', context) return render(request, 'agenda_culturel/page-single.html', context)
def home(request): def home(request):
return week_view(request, home=True) return week_view(request, home=True)
@ -181,34 +182,13 @@ class StaticContentUpdateView(SuccessMessageMixin, LoginRequiredMixin, UpdateVie
success_message = _('The static content has been successfully updated.') success_message = _('The static content has been successfully updated.')
class ContactMessageCreateView(SuccessMessageMixin, CreateView):
model = ContactMessage
template_name = "agenda_culturel/contactmessage_create_form.html"
fields = ['subject', 'name', 'email', 'message']
# class EventCreateView(SuccessMessageMixin, CreateView): success_url = reverse_lazy('home')
# model = Event success_message = _('Your message has been sent successfully.')
# form_class = EventForm
# template_name_suffix = "_create_form"
# success_message = _('The event has been submitted and will be published as soon as it has been validated by the moderation team.')
# def get_form_kwargs(self):
# kwargs = super().get_form_kwargs()
# kwargs['is_authenticated'] = self.request.user.is_authenticated
# return kwargs
# def get_initial(self):
# initial = super().get_initial()
# initial = initial.copy()
# initial["start_day"] = date.today() + timedelta(days=1)
# initial["start_time"] = "20:00"
# initial["end_time"] = "22:00"
# return initial
# def get_success_url(self, **kwargs):
# if self.request.user.is_authenticated:
# return self.object.get_absolute_url()
# else:
# return reverse_lazy("home")
class EventUpdateView(SuccessMessageMixin, LoginRequiredMixin, UpdateView): class EventUpdateView(SuccessMessageMixin, LoginRequiredMixin, UpdateView):