This commit is contained in:
Ruidy Nemausat 2020-03-31 15:49:56 +02:00
parent 58f400d5e7
commit 7c28500c8f
4 changed files with 26 additions and 3 deletions

View file

@ -1,14 +1,13 @@
import datetime
from rental.pricing import get_reservation_price
from django.shortcuts import get_object_or_404
from rental.models import Reservation, Place, Guest
from villafleurie.settings import BASE_DIR
import datetime
from google.auth.transport.requests import Request
from google_auth_oauthlib.flow import InstalledAppFlow
from googleapiclient.discovery import build
import os.path
import pickle
from villafleurie.settings import BASE_DIR
def build_calendar_api_service():
@ -151,3 +150,7 @@ def update_calendar(reservation):
},
}
).execute()
if __name__ == '__main__':
s, c = build_calendar_api_service()

View file

@ -2,6 +2,7 @@ from __future__ import absolute_import, unicode_literals
from celery import shared_task
from villafleurie.settings import EMAIL_HOST_USER, DEFAULT_FROM_EMAIL
import requests
from datetime import datetime
""" Mailer Service used to send messages using API WebHooks.
All Mailers must implement the following methods:
@ -51,4 +52,13 @@ def send_notification(name, email, subject, message, date):
@shared_task
def send_quotation(name, email):
""" Send quotation to customer """
send_notification(
name,
email,
"Nouvelle demande de réservation",
"Depuis le site",
datetime.now()
)
send_confirmation(name, email)

View file

@ -4,6 +4,10 @@
<html lang="fr">
<head>
<meta charset="utf-8" />
<meta
name="google-site-verification"
content="_VvUrAmbWy8dYj9sy2wePTF-ACH7ASdZLzDzScH9Lmo"
/>
<title>VillaFleurie</title>
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
<meta content="" name="keywords" />

View file

@ -1,6 +1,8 @@
from django.shortcuts import render, get_object_or_404
from django.core.exceptions import ValidationError
from django.db import IntegrityError
from django.shortcuts import render, get_object_or_404
from django.views.generic.base import TemplateView
from django.utils.translation import gettext_lazy as _
from rental.forms import ReservationForm, ContactForm
from rental.models import Testimonial, Reservation, Guest, Place, Contact
from rental.pricing import get_reservation_price
@ -92,6 +94,10 @@ def handle_reservation_form(request, context={}, init_template='rental/reservati
template = 'rental/merci.html'
return context, template
else:
form.add_error(None, ValidationError(
_("Cet hébergement n'est pas disponible aux dates indiquées."),
code='invalid'
))
context = {'form': form}
template = 'rental/reservation.html'
return context, template