Zaktualizuj 'hotel/rooms/views.py'

This commit is contained in:
Adrianna Skowrońska 2019-01-27 13:37:59 +00:00
parent 6affb9915b
commit bce5c78d35

View File

@ -43,7 +43,7 @@ def reservation(request):
error = "" error = ""
reservation = Reservation.objects.filter(room_number=room_number).filter(Q(begin_date__range=(begin_datetime, end_datetime)) | Q(end_date__range=(begin_datetime, end_datetime))).first() reservation = Reservation.objects.filter(room_number=room_number).filter(Q(begin_date__range=(begin_datetime, end_datetime)) | Q(end_date__range=(begin_datetime, end_datetime))).first()
if not reservation is None: if not reservation is None:
status = "Pokój " + str(room_number) + " jest już zarezerwowany" status = "Pokój " + str(room_number) + " jest zajęty"
return HttpResponse(template.render({'status': status}, request)) return HttpResponse(template.render({'status': status}, request))
else: else:
@ -70,7 +70,7 @@ def reservation(request):
r.end_date = end_date r.end_date = end_date
r.save() r.save()
status = "Pokój " + str(room_number) + " został pomyślnie zarejestrowany" status = "Pokój " + str(room_number) + " został pomyślnie zarezerwowany"
return HttpResponse(template.render({'status': status}, request)) return HttpResponse(template.render({'status': status}, request))
else: else:
error = "Zły numer dowodu" error = "Zły numer dowodu"