From 403fe158e81c07627779d25167653595be00673b Mon Sep 17 00:00:00 2001 From: Ruidy Nemausat Date: Mon, 16 Dec 2019 00:03:31 +0100 Subject: [PATCH] mailing & notification system --- README.md | 2 +- rental/forms.py | 47 +- rental/mailing.py | 47 ++ rental/templates/rental/contact.html | 246 ++++----- rental/templates/rental/html/activation.html | 494 ++++++++++++++++++ rental/templates/rental/html/assigned.html | 485 +++++++++++++++++ .../templates/rental/html/confirmation.html | 485 +++++++++++++++++ rental/templates/rental/html/expired.html | 486 +++++++++++++++++ rental/templates/rental/html/expiring.html | 486 +++++++++++++++++ rental/templates/rental/html/feedback.html | 493 +++++++++++++++++ rental/templates/rental/html/invitation.html | 486 +++++++++++++++++ rental/templates/rental/html/launch.html | 492 +++++++++++++++++ .../templates/rental/html/reactivation.html | 485 +++++++++++++++++ rental/templates/rental/html/reset.html | 485 +++++++++++++++++ rental/templates/rental/html/started.html | 485 +++++++++++++++++ rental/templates/rental/html/ticket.html | 486 +++++++++++++++++ rental/templates/rental/html/weekly.html | 492 +++++++++++++++++ rental/templates/rental/html/welcome.html | 485 +++++++++++++++++ rental/templates/rental/index.html | 6 +- rental/urls.py | 2 - rental/views.py | 23 +- villafleurie/settings.py | 14 + villafleurie/urls.py | 2 +- 23 files changed, 7049 insertions(+), 165 deletions(-) create mode 100644 rental/mailing.py create mode 100644 rental/templates/rental/html/activation.html create mode 100644 rental/templates/rental/html/assigned.html create mode 100644 rental/templates/rental/html/confirmation.html create mode 100644 rental/templates/rental/html/expired.html create mode 100644 rental/templates/rental/html/expiring.html create mode 100644 rental/templates/rental/html/feedback.html create mode 100644 rental/templates/rental/html/invitation.html create mode 100644 rental/templates/rental/html/launch.html create mode 100644 rental/templates/rental/html/reactivation.html create mode 100644 rental/templates/rental/html/reset.html create mode 100644 rental/templates/rental/html/started.html create mode 100644 rental/templates/rental/html/ticket.html create mode 100644 rental/templates/rental/html/weekly.html create mode 100644 rental/templates/rental/html/welcome.html diff --git a/README.md b/README.md index c2697a3..ea061f2 100644 --- a/README.md +++ b/README.md @@ -98,7 +98,7 @@ Le visiteur doit pouvoir : - Gestion du calendrier ..\_ Tester la synchro avec Google calendar ..\_ Ajouter un date picker dans le formulaire de réservation (j'ai pas envie de jouer avec JQuery) -- Envoyer devis réservation par mail et notification aux hôtes +- Envoyer devis réservation par mail et notification aux hôtes (put it in a background process, personnaliser les htmails) - Ajout page/module de paiement - ajouter les témoignages depuis Booking, AirBnb, ajouter le lien - changer la couleur des liens hypertextes diff --git a/rental/forms.py b/rental/forms.py index 66f17a7..9b880b6 100644 --- a/rental/forms.py +++ b/rental/forms.py @@ -53,13 +53,52 @@ class ReservationForm(forms.Form): # max_length=100, # min_length=4, widget=forms.DateInput(attrs={ - 'class': 'form-control form-control-lg form-control-a', 'placeholder': 'Début *'}), + 'class': 'form-control form-control-lg form-control-a', + 'placeholder': 'Début *'}), required=True) end = forms.DateField( label='', input_formats=['%d/%m/%Y'], - # max_length=100, - # min_length=4, widget=forms.DateInput(attrs={ - 'class': 'form-control form-control-lg form-control-a', 'placeholder': 'Fin *'}), + 'class': 'form-control form-control-lg form-control-a', + 'placeholder': 'Fin *'}), required=True) + + +class ContactForm(forms.Form): + name = forms.CharField( + label='', + widget=forms.TextInput(attrs={ + 'class': 'form-control form-control-lg form-control-a', + 'placeholder': 'Nom *' + }), + required=True, + ) + email = forms.EmailField( + label='', + widget=forms.EmailInput(attrs={ + 'class': 'form-control form-control-lg form-control-a', + 'placeholder': 'Email *' + }), + required=True, + ) + subject = forms.CharField( + label='', + widget=forms.TextInput(attrs={ + 'class': 'form-control form-control-lg form-control-a', + 'placeholder': 'Sujet *' + }), + required=True, + ) + message = forms.CharField( + label='', + # max_length=100, + min_length=4, + widget=forms.Textarea(attrs={ + 'class': 'form-control', + 'cols': '45', + 'rows': '8', + 'placeholder': 'Message *' + }), + required=True + ) diff --git a/rental/mailing.py b/rental/mailing.py new file mode 100644 index 0000000..9978a7f --- /dev/null +++ b/rental/mailing.py @@ -0,0 +1,47 @@ +from django.core.mail import send_mail, mail_admins +from villafleurie.settings import EMAIL_HOST_USER, BASE_DIR +import os + + +def send_confirmation_mail(name, email, template="ticket"): + """ + Send confirmation message to customer + """ + subject = "Nous avons reçu votre message" + message = f" Merci {name}, Bien reçu nous revenons vers vous rapidement ! - HtmlMessage" + + html_path = os.path.join(BASE_DIR, 'rental/templates/rental/html/') + with open(os.path.join(html_path, f"{template}.html"), 'r') as html: + html_message = html.read() + + send_mail( + subject, + message, + EMAIL_HOST_USER, + [email], + html_message=html_message + ) + + +def send_notification(subject, name, message, template="activation"): + """ + Send notification to admins + """ + html_path = os.path.join(BASE_DIR, 'rental/templates/rental/html/') + with open(os.path.join(html_path, f"{template}.html"), 'r') as html: + html_message = html.read() + + mail_admins( + f"{name} a envoyé un message", + f"Sujet : {subject}\nMessage : {message}", + html_message=html_message + ) + + +def send_quotation(reservation): + """ + Send quotation to customer + """ + name = reservation.guest.name + email = reservation.guest.email + send_confirmation_mail(name, email, template="welcome") diff --git a/rental/templates/rental/contact.html b/rental/templates/rental/contact.html index a336285..5a0f8ad 100644 --- a/rental/templates/rental/contact.html +++ b/rental/templates/rental/contact.html @@ -1,169 +1,115 @@ -{% extends 'rental/base.html'%} -{% load static %} +{% extends 'rental/base.html'%} {% load static %} {% block content %} -{% block content %} - - -
-
-
-
-
-

Contactez-nous

- Vous souhaiter effectuer une demande de réservation ? - Vous avez des questions, des suggestions d’amélioration ou des commentaires ? -
Laissez-nous un message !
-
-
-
- +
+
+
+
+
+

Contactez-nous

+ Vous souhaiter effectuer une demande de réservation ? Vous avez des + questions, des suggestions d’amélioration ou des commentaires ? +
Laissez-nous un message !
+
+ +
-
- +
+
- -
-
-
-
-
-
- - -
+
+
+
+
+
+
+
-
-
-
-
-
Votre message a bie nété envoyé. Merci !
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
-
-
- -
-
-
-
- -
+
+
+
+
+ +
+
+ {% csrf_token %} {{ form.as_p }} +
- +
+ +
+
+
+
+ +
+
+
+

Dîtes salut 👋

+
+
+

+ ✉️Email : + location.villafleurie@gmail.com +

+

+ 📞Téléphone : + 06 98 26 76 34 +

+
+
-
-
-
- +
+
+ +
+
+
+

Retrouvez-nous

-
-
-

Dîtes salut 👋

-
-
-

✉️Email : - location.villafleurie@gmail.com -

-

📞Téléphone : - 06 98 26 76 34 -

-
+
+

+ Rue Gerty Archimède, +
+ 97190 Le Gosier, Guadeloupe +

-
-
- -
-
-
-

Retrouvez-nous

-
-
-

- Rue Gerty Archimède, -
97190 Le Gosier, Guadeloupe -

-
-
-
-
-
- +
+
{% endblock %} diff --git a/rental/templates/rental/html/activation.html b/rental/templates/rental/html/activation.html new file mode 100644 index 0000000..1d567c8 --- /dev/null +++ b/rental/templates/rental/html/activation.html @@ -0,0 +1,494 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ +
+ + + + +
+
+

Lorem ipsum dolor sit | View online version

+
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + +
+

+

+ +
+ + + + + + +
+ +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + +
+ + + + + + +
+ +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + + + + + + + +
+
+

You're almost there!

+
+
+
+

Hi ((var:name)), Thank you for signing up to PMS. 

+

To confirm your account, simply click on the button below:

+
+
+ + + + +
+ + Activate My Account + +
+
+
+

If the link doesn’t work, copy this URL into your browser: Var URL

+

Welcome!

+
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + +
+ + + + + +
+ + + + +
+ + + +
+
+ + + + + +
+ + + + +
+ + + +
+
+ + + + + +
+ + + + +
+ + + +
+
+ +
+
+

Page 1   |   Page 2   |   Page 3

+

Click here to unsubscribe.
Created by Mailjet

+
+
+
+ +
+
+ +
+ + + \ No newline at end of file diff --git a/rental/templates/rental/html/assigned.html b/rental/templates/rental/html/assigned.html new file mode 100644 index 0000000..6fc8a8f --- /dev/null +++ b/rental/templates/rental/html/assigned.html @@ -0,0 +1,485 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ +
+ + + + +
+
+

Lorem ipsum dolor sit | View online version

+
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + +
+

+

+ +
+ + + + + + +
+ +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + +
+ + + + + + +
+ +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + + + + +
+
+

Hi ((var:first_name)),

+
+
+
+

A new task has been added to your account on PMS.

+
+
+ + + + +
+ + Go To PMS + +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + +
+ + + + + +
+ + + + +
+ + + +
+
+ + + + + +
+ + + + +
+ + + +
+
+ + + + + +
+ + + + +
+ + + +
+
+ +
+
+

Page 1   |   Page 2   |   Page 3

+

Click here to unsubscribe.
Created by Mailjet

+
+
+
+ +
+
+ +
+ + + \ No newline at end of file diff --git a/rental/templates/rental/html/confirmation.html b/rental/templates/rental/html/confirmation.html new file mode 100644 index 0000000..1516bf0 --- /dev/null +++ b/rental/templates/rental/html/confirmation.html @@ -0,0 +1,485 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ +
+ + + + +
+
+

Lorem ipsum dolor sit | View online version

+
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + +
+

+

+ +
+ + + + + + +
+ +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + +
+ + + + + + +
+ +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + + + + +
+
+

Your PMS password has been updated!

+
+
+ + + + +
+ + Go To PMS + +
+
+
+

If you did not just try to reset your password, please contact our Support Team to help secure your account.

+
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + +
+ + + + + +
+ + + + +
+ + + +
+
+ + + + + +
+ + + + +
+ + + +
+
+ + + + + +
+ + + + +
+ + + +
+
+ +
+
+

Page 1   |   Page 2   |   Page 3

+

Click here to unsubscribe.
Created by Mailjet

+
+
+
+ +
+
+ +
+ + + \ No newline at end of file diff --git a/rental/templates/rental/html/expired.html b/rental/templates/rental/html/expired.html new file mode 100644 index 0000000..78333a4 --- /dev/null +++ b/rental/templates/rental/html/expired.html @@ -0,0 +1,486 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ +
+ + + + +
+
+

Lorem ipsum dolor sit | View online version

+
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + +
+

+

+ +
+ + + + + + +
+ +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + +
+ + + + + + +
+ +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + + + + +
+
+

Hey ((var:first_name)),
Your trial has expired.

+
+
+
+

Unfortunately, you no longer have access to these great benefits:
((List_of_benefits))

+

But don't worry, You can upgrade right away to enjoy the full potential of ((var:product_name)).

+
+
+ + + + +
+ + Upgrade Now + +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + +
+ + + + + +
+ + + + +
+ + + +
+
+ + + + + +
+ + + + +
+ + + +
+
+ + + + + +
+ + + + +
+ + + +
+
+ +
+
+

Page 1   |   Page 2   |   Page 3

+

Click here to unsubscribe.
Created by Mailjet

+
+
+
+ +
+
+ +
+ + + \ No newline at end of file diff --git a/rental/templates/rental/html/expiring.html b/rental/templates/rental/html/expiring.html new file mode 100644 index 0000000..4c07b68 --- /dev/null +++ b/rental/templates/rental/html/expiring.html @@ -0,0 +1,486 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ +
+ + + + +
+
+

Lorem ipsum dolor sit | View online version

+
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + +
+

+

+ +
+ + + + + + +
+ +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + +
+ + + + + + +
+ +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + + + + +
+
+

Uh-oh!
Time is about to run out.

+
+
+
+

There are only 3 days left before your trial comes to an end. 

+

You'll no longer have access to these benefits:
((List_of_benefits))

+
+
+ + + + +
+ + Upgrade Now! + +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + +
+ + + + + +
+ + + + +
+ + + +
+
+ + + + + +
+ + + + +
+ + + +
+
+ + + + + +
+ + + + +
+ + + +
+
+ +
+
+

Page 1   |   Page 2   |   Page 3

+

Click here to unsubscribe.
Created by Mailjet

+
+
+
+ +
+
+ +
+ + + \ No newline at end of file diff --git a/rental/templates/rental/html/feedback.html b/rental/templates/rental/html/feedback.html new file mode 100644 index 0000000..876c0d1 --- /dev/null +++ b/rental/templates/rental/html/feedback.html @@ -0,0 +1,493 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ +
+ + + + +
+
+

Lorem ipsum dolor sit | View online version

+
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + +
+

+

+ +
+ + + + + + +
+ +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + +
+ + + + + + +
+ +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + + + + + + + +
+
+

Hi ((var:first_name)), Thanks for using PMS.

+
+
+
+

We really appreciate you trusting PMS. 

+

To help us improve, we'd like to ask you a few questions about your experience so far. It will only take 3 minutes, and your answers will help us make PMS even better for you and other users.

+
+
+ + + + +
+ + Take The Survey + +
+
+
+

Thanks,
The PMS Team.

+
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + +
+ + + + + +
+ + + + +
+ + + +
+
+ + + + + +
+ + + + +
+ + + +
+
+ + + + + +
+ + + + +
+ + + +
+
+ +
+
+

Page 1   |   Page 2   |   Page 3

+

Click here to unsubscribe.
Created by Mailjet

+
+
+
+ +
+
+ +
+ + + \ No newline at end of file diff --git a/rental/templates/rental/html/invitation.html b/rental/templates/rental/html/invitation.html new file mode 100644 index 0000000..b22bed4 --- /dev/null +++ b/rental/templates/rental/html/invitation.html @@ -0,0 +1,486 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ +
+ + + + +
+
+

Lorem ipsum dolor sit | View online version

+
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + +
+

+

+ +
+ + + + + + +
+ +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + +
+ + + + + + +
+ +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + + + + +
+
+

Hi ((var:first_name)),

+
+
+
+

((var:inviter)) has invited you to join a PMS account. 

+

Click the button below to accept the invitation and login. If you’re having trouble, please contact our support team.

+
+
+ + + + +
+ + Accept Invitation + +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + +
+ + + + + +
+ + + + +
+ + + +
+
+ + + + + +
+ + + + +
+ + + +
+
+ + + + + +
+ + + + +
+ + + +
+
+ +
+
+

Page 1   |   Page 2   |   Page 3

+

Click here to unsubscribe.
Created by Mailjet

+
+
+
+ +
+
+ +
+ + + \ No newline at end of file diff --git a/rental/templates/rental/html/launch.html b/rental/templates/rental/html/launch.html new file mode 100644 index 0000000..a52afcb --- /dev/null +++ b/rental/templates/rental/html/launch.html @@ -0,0 +1,492 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ +
+ + + + +
+
+

Lorem ipsum dolor sit | View online version

+
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + +
+

+

+ +
+ + + + + + +
+ +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + +
+ + + + + + +
+ +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + + + + + + + +
+
+

Hey ((var:first_name)),

+
+
+
+

We are thrilled to see that you are using ((var:product_name)). Today is a big day for us. We officially launched on Product Hunt. If you like using ((var:product_name)), it'd be amazing if you could support us and give your feedback.

+
+
+ + + + +
+ + Support ((var:product_name)) + +
+
+
+

Cheers,
The ((var:product_name)) Team

+
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + +
+ + + + + +
+ + + + +
+ + + +
+
+ + + + + +
+ + + + +
+ + + +
+
+ + + + + +
+ + + + +
+ + + +
+
+ +
+
+

Page 1   |   Page 2   |   Page 3

+

Click here to unsubscribe.
Created by Mailjet

+
+
+
+ +
+
+ +
+ + + \ No newline at end of file diff --git a/rental/templates/rental/html/reactivation.html b/rental/templates/rental/html/reactivation.html new file mode 100644 index 0000000..57c0c8b --- /dev/null +++ b/rental/templates/rental/html/reactivation.html @@ -0,0 +1,485 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ +
+ + + + +
+
+

Lorem ipsum dolor sit | View online version

+
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + +
+

+

+ +
+ + + + + + +
+ +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + +
+ + + + + + +
+ +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + + + + +
+
+

Hi ((var:name)),

+
+
+
+

We haven’t seen you in awhile.
Is there anything we can do to get you get started again?

+
+
+ + + + +
+ + Go to ((var:product_name)) + +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + +
+ + + + + +
+ + + + +
+ + + +
+
+ + + + + +
+ + + + +
+ + + +
+
+ + + + + +
+ + + + +
+ + + +
+
+ +
+
+

Page 1   |   Page 2   |   Page 3

+

Click here to unsubscribe.
Created by Mailjet

+
+
+
+ +
+
+ +
+ + + \ No newline at end of file diff --git a/rental/templates/rental/html/reset.html b/rental/templates/rental/html/reset.html new file mode 100644 index 0000000..f6a5f6b --- /dev/null +++ b/rental/templates/rental/html/reset.html @@ -0,0 +1,485 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ +
+ + + + +
+
+

Lorem ipsum dolor sit | View online version

+
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + +
+

+

+ +
+ + + + + + +
+ +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + +
+ + + + + + +
+ +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + + + + +
+
+

Forgot your password?

+
+
+
+

Not to worry, let's get you a new one.

+
+
+ + + + +
+ + Reset password + +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + +
+ + + + + +
+ + + + +
+ + + +
+
+ + + + + +
+ + + + +
+ + + +
+
+ + + + + +
+ + + + +
+ + + +
+
+ +
+
+

Page 1   |   Page 2   |   Page 3

+

Click here to unsubscribe.
Created by Mailjet

+
+
+
+ +
+
+ +
+ + + \ No newline at end of file diff --git a/rental/templates/rental/html/started.html b/rental/templates/rental/html/started.html new file mode 100644 index 0000000..ef526b7 --- /dev/null +++ b/rental/templates/rental/html/started.html @@ -0,0 +1,485 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ +
+ + + + +
+
+

Lorem ipsum dolor sit | View online version

+
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + +
+

+

+ +
+ + + + + + +
+ +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + +
+ + + + + + +
+ +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + + + + +
+
+

Thank you so much for signing up for the free trial!

+
+
+
+

We're thrilled you can join us! During your 7 day trial, you'll have full access to all premium features including:
((Add_features))

+
+
+ + + + +
+ + Explore The Premium Features + +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + +
+ + + + + +
+ + + + +
+ + + +
+
+ + + + + +
+ + + + +
+ + + +
+
+ + + + + +
+ + + + +
+ + + +
+
+ +
+
+

Page 1   |   Page 2   |   Page 3

+

Click here to unsubscribe.
Created by Mailjet

+
+
+
+ +
+
+ +
+ + + \ No newline at end of file diff --git a/rental/templates/rental/html/ticket.html b/rental/templates/rental/html/ticket.html new file mode 100644 index 0000000..4b07cab --- /dev/null +++ b/rental/templates/rental/html/ticket.html @@ -0,0 +1,486 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ +
+ + + + +
+
+

Lorem ipsum dolor sit | View online version

+
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + +
+

+

+ +
+ + + + + + +
+ +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + +
+ + + + + + +
+ +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + + + + +
+
+

Hi ((var:first_name)),
thanks for your email!

+
+
+
+

 

+

We’ve received your contact request, and someone from our team will be in touch soon. In the meantime, our FAQ might help get you an instant answer to your question.

+
+
+ + + + +
+ + Go to the FAQ + +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + +
+ + + + + +
+ + + + +
+ + + +
+
+ + + + + +
+ + + + +
+ + + +
+
+ + + + + +
+ + + + +
+ + + +
+
+ +
+
+

Page 1   |   Page 2   |   Page 3

+

Click here to unsubscribe.
Created by Mailjet

+
+
+
+ +
+
+ +
+ + + \ No newline at end of file diff --git a/rental/templates/rental/html/weekly.html b/rental/templates/rental/html/weekly.html new file mode 100644 index 0000000..bbc7d1d --- /dev/null +++ b/rental/templates/rental/html/weekly.html @@ -0,0 +1,492 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ +
+ + + + +
+
+

Lorem ipsum dolor sit | View online version

+
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + +
+

+

+ +
+ + + + + + +
+ +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + +
+ + + + + + +
+ +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + + + + + + + +
+
+

Your Weekly Activity

+
+
+
+

((Extract of Dashboard))

+
+
+ + + + +
+ + Go To Dashboard + +
+
+
+

Thanks for trusting PMS

+
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + +
+ + + + + +
+ + + + +
+ + + +
+
+ + + + + +
+ + + + +
+ + + +
+
+ + + + + +
+ + + + +
+ + + +
+
+ +
+
+

Page 1   |   Page 2   |   Page 3

+

Click here to unsubscribe.
Created by Mailjet

+
+
+
+ +
+
+ +
+ + + \ No newline at end of file diff --git a/rental/templates/rental/html/welcome.html b/rental/templates/rental/html/welcome.html new file mode 100644 index 0000000..e8afcc6 --- /dev/null +++ b/rental/templates/rental/html/welcome.html @@ -0,0 +1,485 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + + + +
+ +
+ + + + +
+
+

Lorem ipsum dolor sit | View online version

+
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + +
+

+

+ +
+ + + + + + +
+ +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + +
+ + + + + + +
+ +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + + + + +
+
+

Welcome ((var:first_name)) ! We are so happy to have you on board.

+
+
+
+

You can now start using ((var:product_name)).

+
+
+ + + + +
+ + Get Started + +
+
+
+ +
+
+ +
+ + + + + + +
+ +
+ + + + + + + +
+ + + + + +
+ + + + +
+ + + +
+
+ + + + + +
+ + + + +
+ + + +
+
+ + + + + +
+ + + + +
+ + + +
+
+ +
+
+

Page 1   |   Page 2   |   Page 3

+

Click here to unsubscribe.
Created by Mailjet

+
+
+
+ +
+
+ +
+ + + \ No newline at end of file diff --git a/rental/templates/rental/index.html b/rental/templates/rental/index.html index 1c71aa6..032a0c1 100644 --- a/rental/templates/rental/index.html +++ b/rental/templates/rental/index.html @@ -72,7 +72,7 @@

@@ -95,7 +95,7 @@

@@ -117,7 +117,7 @@

diff --git a/rental/urls.py b/rental/urls.py index 2ae9f16..2f0c368 100644 --- a/rental/urls.py +++ b/rental/urls.py @@ -7,10 +7,8 @@ from django.contrib.staticfiles.urls import static, staticfiles_urlpatterns app_name = 'rental' urlpatterns = [ - # path('', views.Accueil.as_view(), name='index'), path('', views.index, name='index'), path('hebergements/', views.liste_location, name='list_place'), - # path('/', views.Location.as_view(), name='detail_place'), path('/', views.location, name='detail_place'), path('calendar//', views.calendar, name='calendar') ] diff --git a/rental/views.py b/rental/views.py index 4b17f70..2204d13 100644 --- a/rental/views.py +++ b/rental/views.py @@ -3,11 +3,11 @@ from django.views.generic import ListView, DetailView, CreateView, UpdateView, D from .models import Testimonial, Reservation, Guest, Place from django.urls import reverse_lazy from django.views.generic.base import TemplateView -from .forms import ReservationForm +from .forms import ReservationForm, ContactForm from django.db import IntegrityError from rental.pricing import get_reservation_price from rental.bookings import check_availability, synchronize_calendars, update_calendar -# import sys +from rental.mailing import send_confirmation_mail, send_notification, send_quotation def index(request): @@ -123,10 +123,12 @@ def reservation(request): end=end, price=price ) + send_quotation(reservation) update_calendar(reservation) context = { 'reservation': reservation } + return render(request, 'rental/merci.html', context) else: context = {'form': form} @@ -155,8 +157,21 @@ def calendar(request, place_name): return render(request, 'rental/calendar.html', context) -class Contact(TemplateView): - template_name = 'rental/contact.html' +def contact(request): + if request.method == 'POST': + form = ContactForm(request.POST) + if form.is_valid(): + name = form.cleaned_data['name'] + email = form.cleaned_data['email'] + subject = form.cleaned_data['subject'] + message = form.cleaned_data['message'] + + send_confirmation_mail(name, email) + send_notification(subject, name, message) + else: + form = ContactForm() + context = {'form': form} + return render(request, 'rental/contact.html', context) class Legal(TemplateView): diff --git a/villafleurie/settings.py b/villafleurie/settings.py index ec0b896..317070b 100644 --- a/villafleurie/settings.py +++ b/villafleurie/settings.py @@ -3,6 +3,11 @@ import os BASE_DIR = os.path.dirname(os.path.dirname(__file__)) +ADMINS = [ + ("Ruidy", "ruidy.nemausat@gmail.com"), + ("VillaFleurie", "location.villafleurie@gmail.com") +] + SECRET_KEY = os.environ.get('SECRET_KEY') SECRET_KEY = 'q00_4wqdc^n=7)p2lm)!gy&fms8md_b4#1aqysllvqq==2c9!$' @@ -130,3 +135,12 @@ STATIC_URL = '/static/' MEDIA_ROOT = os.path.join(BASE_DIR, "media") MEDIA_URL = '/media/' + +EMAIL_HOST = "smtp.gmail.com" +EMAIL_USE_TLS = True +EMAIL_PORT = 587 +EMAIL_SUBJECT_PREFIX = "[VillaFleurieGuadeloupe] " +DEFAULT_FROM_EMAIL = "'Nilka, VillaFleurie' " +EMAIL_HOST_USER = "location.villafleurie@gmail.com" +EMAIL_HOST_PASSWORD = os.environ.get('SECRET_KEY') +EMAIL_HOST_PASSWORD = "location229818" diff --git a/villafleurie/urls.py b/villafleurie/urls.py index b0c928c..08e36d3 100644 --- a/villafleurie/urls.py +++ b/villafleurie/urls.py @@ -7,7 +7,7 @@ from rental import views urlpatterns = [ path('admin/', admin.site.urls), - path('contact/', views.Contact.as_view(), name='contact'), + path('contact/', views.contact, name='contact'), path('a-propos/', views.About.as_view(), name='about'), path('reservation/', views.reservation, name='reservation'), path('legal/', views.Legal.as_view(), name='legal'),