From 5edc4fc67560806991845bf2f1132229610935ec Mon Sep 17 00:00:00 2001 From: Ruidy Nemausat Date: Wed, 8 Apr 2020 12:26:00 +0200 Subject: [PATCH] bookingform debug; cleaning requirements --- TODO.md | 3 +- rental/services/calendar.py | 7 ++-- rental/views/booking.py | 1 + rental/views/contact.py | 1 + requirements.txt | 67 ++++++++++++++----------------------- 5 files changed, 33 insertions(+), 46 deletions(-) diff --git a/TODO.md b/TODO.md index 3931d48..bbf324d 100644 --- a/TODO.md +++ b/TODO.md @@ -22,7 +22,7 @@ - [ ] Réservation page : Ajouter des photos. Renvoyer vers la page Location onClick sur Réserver TX. Proposer Upsells : navette + location voiture. - [x] Vider le contenu du folder root ? - [x] Pages confirmation message contact envoyé, -- [ ] reservations réussies ou non (expliquer pourquoi) +- [x] reservations réussies ou non (expliquer pourquoi) - [ ] SSL certificate - [ ] [github](https://github.com/linuxserver/docker-letsencrypt) - [ ] [medium](https://medium.com/@gardenvariety/easy-https-with-letsencrypt-and-docker-compose-168df411e2d2) @@ -36,3 +36,4 @@ - [ ] Calendar API: [docs](https://github.com/googleapis/google-api-python-client/blob/master/docs/start.md) - [ ] Blog - [x] Call update_calendar from BookingManager. SOlve circular dependencies +- [ ] Trigger booking price Update when booking modified (calendar.py l:100) diff --git a/rental/services/calendar.py b/rental/services/calendar.py index 47cf9fe..7d65d3e 100644 --- a/rental/services/calendar.py +++ b/rental/services/calendar.py @@ -81,7 +81,6 @@ def synchronize(place): start = reservation['start'] end = reservation['end'] - price = reservation['price'] guest = Guest.objects.filter(name=reservation['guest']) if not guest.exists(): @@ -104,10 +103,10 @@ def synchronize(place): db_booking.guest = guest, db_booking.start = start, db_booking.end = end - db_booking.price = price + # db_booking.price = price -def get_bookings(place): +def get_bookings_from_db(place): """ Synchronize with Master calendar via a call to synchronize_calendar Returns a list of all related place reservations """ @@ -120,7 +119,7 @@ def get_bookings(place): def check_availability(place, start_date, end_date): """ check if the related place is available during a given period """ - bookings = get_bookings(place) + bookings = get_bookings_from_db(place) for booking in bookings: if (booking.start <= start_date <= booking.end) or (booking.start <= end_date <= booking.end): return False diff --git a/rental/views/booking.py b/rental/views/booking.py index 20086cd..bbb4127 100644 --- a/rental/views/booking.py +++ b/rental/views/booking.py @@ -1,6 +1,7 @@ from django.core.exceptions import ValidationError from django.db import IntegrityError from django.shortcuts import render, get_object_or_404 +from django.utils.translation import gettext_lazy as _ from rental.forms.booking import BookingForm from rental.models.booking import Booking from rental.models.guest import Guest diff --git a/rental/views/contact.py b/rental/views/contact.py index f2e7e34..301df1e 100644 --- a/rental/views/contact.py +++ b/rental/views/contact.py @@ -1,5 +1,6 @@ from django.shortcuts import render from rental.forms.contact import ContactForm +from rental.models.contact import Contact def view(request): diff --git a/requirements.txt b/requirements.txt index 8986636..35d4fd3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,54 +1,39 @@ amqp==2.5.2 -asgiref==3.2.3 -astroid==2.3.3 -beautifulsoup4==4.8.1 -billiard==3.6.1.0 -bs4==0.0.1 -cachetools==3.1.1 -celery==4.4.0 -certifi==2019.11.28 +asgiref==3.2.7 +beautifulsoup4==4.9.0 +billiard==3.6.3.0 +cachetools==4.0.0 +celery==4.4.2 +certifi==2020.4.5.1 chardet==3.0.4 -dj-database-url==0.5.0 -Django==3.0.4 -get==2019.4.13 +Django==3.0.5 google==2.0.3 -google-api-python-client==1.7.11 -google-auth==1.7.2 +google-api-core==1.16.0 +google-api-python-client==1.8.0 +google-auth==1.13.1 google-auth-httplib2==0.0.3 google-auth-oauthlib==0.4.1 +googleapis-common-protos==1.51.0 gunicorn==20.0.4 -httplib2==0.14.0 -idna==2.8 -importlib-metadata==1.2.0 -isort==4.3.21 -kombu==4.6.7 -lazy-object-proxy==1.4.3 -lxml==4.5.0 -mccabe==0.6.1 -more-itertools==8.0.2 -oauth2client==4.1.3 +httplib2==0.17.1 +idna==2.9 +importlib-metadata==1.6.0 +kombu==4.6.8 oauthlib==3.1.0 -path==13.1.0 -Pillow==7.1.0 -post==2019.4.13 -psycopg2==2.8.4 -public==2019.4.13 +Pillow==7.1.1 +protobuf==3.11.3 +psycopg2==2.8.5 pyasn1==0.4.8 -pyasn1-modules==0.2.7 -pycodestyle==2.5.0 +pyasn1-modules==0.2.8 pytz==2019.3 -query-string==2019.4.13 -request==2019.4.13 -requests==2.22.0 +requests==2.23.0 requests-oauthlib==1.3.0 rsa==4.0 -six==1.13.0 -soupsieve==1.9.5 -sqlparse==0.3.0 -typed-ast==1.4.0 -uritemplate==3.0.0 -urllib3==1.25.7 +six==1.14.0 +soupsieve==2.0 +sqlparse==0.3.1 +uritemplate==3.0.1 +urllib3==1.25.8 vine==1.3.0 -whitenoise==4.1.4 -wrapt==1.11.2 +whitenoise==5.0.1 zipp==3.1.0