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 ""
"Project-Id-Version: agenda_culturel\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"
"Last-Translator: 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-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"
msgstr "Nom"
#: agenda_culturel/models.py:25
#: agenda_culturel/models.py:19 agenda_culturel/models.py:48
msgid "Category name"
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"
msgstr "Nom alternatif"
#: agenda_culturel/models.py:26
#: agenda_culturel/models.py:49
msgid "Alternative name used with a time period"
msgstr "Nom alternatif utilisé avec une période de temps"
#: agenda_culturel/models.py:27
#, fuzzy
#| msgid "Short title"
#: agenda_culturel/models.py:50
msgid "Short name"
msgstr "Nom court"
#: agenda_culturel/models.py:27
#: agenda_culturel/models.py:50
msgid "Short name of the category"
msgstr "Nom court de la catégorie"
#: agenda_culturel/models.py:28
#: agenda_culturel/models.py:51
msgid "Color"
msgstr "Couleur"
#: agenda_culturel/models.py:28
#: agenda_culturel/models.py:51
msgid "Color used as background for the category"
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"
msgstr "Catégorie"
#: agenda_culturel/models.py:54
#: agenda_culturel/models.py:89
msgid "Categories"
msgstr "Catégories"
#: agenda_culturel/models.py:59
#: agenda_culturel/models.py:94
msgid "Published"
msgstr "Publié"
#: agenda_culturel/models.py:60
msgid "Trash"
msgstr "Corbeille"
#: agenda_culturel/models.py:61
#: agenda_culturel/models.py:95
msgid "Draft"
msgstr "Brouillon"
#: agenda_culturel/models.py:66
#: agenda_culturel/models.py:96
msgid "Trash"
msgstr "Corbeille"
#: agenda_culturel/models.py:101
msgid "Title"
msgstr "Titre"
#: agenda_culturel/models.py:66
#: agenda_culturel/models.py:101
msgid "Short title"
msgstr "Titre court"
#: agenda_culturel/models.py:68
#: agenda_culturel/models.py:103
msgid "Status"
msgstr "Status"
#: agenda_culturel/models.py:70
#: agenda_culturel/models.py:105
msgid "Category of the event"
msgstr "Catégorie de l'événement"
#: agenda_culturel/models.py:72
#: agenda_culturel/models.py:107
msgid "Day of the event"
msgstr "Date de l'événement"
#: agenda_culturel/models.py:73
#: agenda_culturel/models.py:108
msgid "Starting time"
msgstr "Heure de début"
#: agenda_culturel/models.py:75
#: agenda_culturel/models.py:110
msgid "End day of the event"
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."
msgstr ""
"Date de fin de l'événement, uniquement nécessaire s'il est différent du "
"premier jour de l'événement"
#: agenda_culturel/models.py:76
#: agenda_culturel/models.py:111
msgid "Final time"
msgstr "Heure de fin"
#: agenda_culturel/models.py:78
#: agenda_culturel/models.py:113
msgid "Location"
msgstr "Localisation"
#: agenda_culturel/models.py:78
#: agenda_culturel/models.py:113
msgid "Address of the event"
msgstr "Adresse de l'événement"
#: agenda_culturel/models.py:80
#: agenda_culturel/models.py:115
msgid "Description"
msgstr "Description"
#: agenda_culturel/models.py:80
#: agenda_culturel/models.py:115
msgid "General description of the event"
msgstr "Description générale de l'événement"
#: agenda_culturel/models.py:82
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"
#: agenda_culturel/models.py:117
msgid "Illustration (local image)"
msgstr "Illustration (image locale)"
#: agenda_culturel/models.py:117
msgid "Illustration image stored in the agenda server"
msgstr "Image d'illustration stockée sur le serveur de l'agenda"
msgid "The event has been successfully modified."
msgstr "L'événement a été modifié avec succès."
#: agenda_culturel/models.py:119
msgid "Illustration"
msgstr "Illustration"
msgid "The event has been successfully deleted."
msgstr "L'événement a été supprimé avec succès"
#: agenda_culturel/models.py:119
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."
msgstr "L'adresse a été soumise et l'événement associé sera prochainement intégré à l'agenda après validation."
#: agenda_culturel/models.py:120
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."
msgstr "Le contenu statique a été modifié avec succès."
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/views.py:191
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."
msgstr "La date de fin ne peut pas être avant aujourd'hui."
#: agenda_culturel/views.py:197
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."
msgstr "La date de début ne peut pas être avant aujourd'hui."
#: agenda_culturel/views.py:208
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."
msgstr "L'heure de fin ne peut pas être avant l'heure de début."
#: agenda_culturel/views.py:246
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."
msgstr "L'événement a été soumis et sera publié dès qu'il aura été validé par l'équipe de modération."
#: agenda_culturel/views.py:249
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."
msgstr "L'URL a été prise en compte, et l'événement associé sera disponible dans quelques instants pour validation."
#: agenda_culturel/views.py:279
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."
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 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."
#: agenda_culturel/views.py:283
msgid ""
"Unable to extract an event from the proposed URL. Please use the form below "
"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."
#: agenda_culturel/views.py:292
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."
#: 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."
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."
msgstr "Cette URL a déjà été soumise, mais n'a pas été retenue par l'équipe de modération pour la publication."
msgid "The event is saved."
msgstr "L'événement est enregistré."
#: agenda_culturel/views.py:329
msgid "Search"
msgstr "Rechercher"

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):
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>
</div>
<div>
Contact
<a href="{% url 'contact' %}">Contact</a>
</div>
<div>
<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('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('mentions-legales', mentions_legales, name='mentions_legales'),
path('contact', ContactMessageCreateView.as_view(), name='contact')
]
if settings.DEBUG:

View File

@ -13,7 +13,7 @@ import urllib
from .forms import EventSubmissionForm, EventForm
from .models import Event, Category, StaticContent
from .models import Event, Category, StaticContent, ContactMessage
from django.utils import timezone
from enum import StrEnum
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") }
return render(request, 'agenda_culturel/page-single.html', context)
def home(request):
return week_view(request, home=True)
@ -181,34 +182,13 @@ class StaticContentUpdateView(SuccessMessageMixin, LoginRequiredMixin, UpdateVie
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):
# model = Event
# 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")
success_url = reverse_lazy('home')
success_message = _('Your message has been sent successfully.')
class EventUpdateView(SuccessMessageMixin, LoginRequiredMixin, UpdateView):