diff --git a/README.md b/README.md index 981e023..ec40e5e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![Build Status](https://travis-ci.org/fhinkel/create-download-link.svg?branch=master)](https://travis-ci.org/fhinkel/create-download-link) + # Villafleurie : moteur de réservation autonome `V 0.1 Le site est structuré. Il reste à appliquer le contenu et les visuels` @@ -61,14 +63,20 @@ Le visiteur doit pouvoir : ## TO DO -* image de garde des logements sur la page hébergements -* Les photos de la page à propos * Page service : navette + location -* écrire les mentions légales * Gestion du calendrier +..* Google calendar pour afficher les disponibilités +.. * Check si les dates choisies sont libres +* Module calcul prix réservation, afficher le résultat sur la page remerciement +ou envoyer devis par mail … * Ajout page/module de paiement +* ajouter les témoignages depuis Booking, AirBnb, ajouter le lien * changer la couleur des liens hypertextes * changer l'adresse de l'admin -* ajouter un diaporama en bas de page ? -* ajouter les témoignages depuis Booking, AirBnb, ajouter le lien +* ajouter un diaporama en bas de page de location ? * deploy on Heroku or somewhere else … don't care +* change placeholders for dates +* factoriser le code de réservation + + +## BUGS diff --git a/media/img/a8cb2ffc-451e-4444-a60b-d8f35668873b.jpg b/media/img/a8cb2ffc-451e-4444-a60b-d8f35668873b.jpg new file mode 100644 index 0000000..383c739 Binary files /dev/null and b/media/img/a8cb2ffc-451e-4444-a60b-d8f35668873b.jpg differ diff --git a/media/img/b871ce71-2e80-4da1-be7c-b1d5a1374cef.jpg b/media/img/b871ce71-2e80-4da1-be7c-b1d5a1374cef.jpg new file mode 100644 index 0000000..c316933 Binary files /dev/null and b/media/img/b871ce71-2e80-4da1-be7c-b1d5a1374cef.jpg differ diff --git a/media/img/original.jpg b/media/img/original.jpg new file mode 100644 index 0000000..66c0cb8 Binary files /dev/null and b/media/img/original.jpg differ diff --git a/rental/forms.py b/rental/forms.py index 6007296..f76a62a 100644 --- a/rental/forms.py +++ b/rental/forms.py @@ -33,3 +33,17 @@ class ReservationForm(forms.Form): min_length=4, widget=forms.Textarea(attrs={'class': 'form-control', 'cols': '45', 'rows':'8', 'placeholder': 'Message *'}), required=True) + start = 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': '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 *'}), + required=True) diff --git a/rental/models.py b/rental/models.py index 74286c4..958a09e 100644 --- a/rental/models.py +++ b/rental/models.py @@ -2,6 +2,14 @@ from django.db import models from phonenumber_field.modelfields import PhoneNumberField +class Image(models.Model): + def __str__(self): + return self.alt + + img=models.ImageField(upload_to='img/', null=True,blank=True) + alt=models.CharField(max_length=100) + + class Place(models.Model): class Meta: verbose_name = "Appartement" @@ -18,17 +26,8 @@ class Place(models.Model): surface=models.IntegerField(null=True,blank=True) beds=models.IntegerField(null=True,blank=True) max_occupation=models.IntegerField(null=True,blank=True) - - -class Image(models.Model): - def __str__(self): - return self.alt - - url=models.ImageField(upload_to='img/', null=True,blank=True) - alt=models.CharField(max_length=100) - place=models.ManyToManyField(Place, related_name = "images",blank=True) - - + thumbnail=models.ForeignKey(Image, on_delete=models.CASCADE, blank=True, null=True) + images=models.ManyToManyField(Image, related_name = "places", blank=True) class Guest(models.Model): @@ -50,9 +49,11 @@ class Reservation(models.Model): def __str__(self): return "Réservation du {} par {}".format(self.place, self.guest) - place=models.OneToOneField(Place,on_delete=models.CASCADE) + place=models.ForeignKey(Place,on_delete=models.CASCADE) guest=models.ForeignKey(Guest,on_delete=models.CASCADE) message=models.TextField(blank=True) + start=models.DateField() + end=models.DateField() class Testimonial(models.Model): diff --git a/rental/pricing.py b/rental/pricing.py new file mode 100644 index 0000000..55c08fc --- /dev/null +++ b/rental/pricing.py @@ -0,0 +1,20 @@ +""" +Compute booking price as a function of place and dates +""" +from models import Place +from datetime import * +from django.shortcuts import get_object_or_404 + +place_name = 'T2' +start = datetime(2019, 11, 14) +end = datetime(2019, 11, 20) + +stay = end-start +nights = stay.days + +def quotation(place_name, nights): + place = get_object_or_404(Place, name=place_name) + return place.price_per_night * (end - start) + +x = quotation(place_name, nights) +print(x) diff --git a/rental/static/rental/img/about-2.jpg b/rental/static/rental/img/about-2.jpg index a107d41..8bb0f1b 100644 Binary files a/rental/static/rental/img/about-2.jpg and b/rental/static/rental/img/about-2.jpg differ diff --git a/rental/static/rental/img/about-22.jpg b/rental/static/rental/img/about-22.jpg new file mode 100644 index 0000000..a107d41 Binary files /dev/null and b/rental/static/rental/img/about-22.jpg differ diff --git a/rental/static/rental/img/slide-about-1.jpg b/rental/static/rental/img/slide-about-1.jpg index 4c740b3..b025eec 100644 Binary files a/rental/static/rental/img/slide-about-1.jpg and b/rental/static/rental/img/slide-about-1.jpg differ diff --git a/rental/static/rental/img/slide-about-11.jpg b/rental/static/rental/img/slide-about-11.jpg new file mode 100644 index 0000000..4c740b3 Binary files /dev/null and b/rental/static/rental/img/slide-about-11.jpg differ diff --git a/rental/templates/rental/about.html b/rental/templates/rental/about.html index 14edb29..e6f8e08 100644 --- a/rental/templates/rental/about.html +++ b/rental/templates/rental/about.html @@ -81,7 +81,7 @@ -
+ {% endblock %} diff --git a/rental/templates/rental/detail_place.html b/rental/templates/rental/detail_place.html index 925ffb3..8a6b3b3 100644 --- a/rental/templates/rental/detail_place.html +++ b/rental/templates/rental/detail_place.html @@ -40,7 +40,7 @@ diff --git a/rental/templates/rental/index.html b/rental/templates/rental/index.html index f984003..1c71aa6 100644 --- a/rental/templates/rental/index.html +++ b/rental/templates/rental/index.html @@ -7,7 +7,7 @@
+ {% endblock %} diff --git a/rental/templates/rental/temoignage.html b/rental/templates/rental/temoignage.html index e3429d1..8d8b7d9 100644 --- a/rental/templates/rental/temoignage.html +++ b/rental/templates/rental/temoignage.html @@ -14,7 +14,6 @@