fix
This commit is contained in:
parent
646e675910
commit
ffd81453b7
0
hotel/manage.py
Executable file → Normal file
0
hotel/manage.py
Executable file → Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -3,6 +3,7 @@ from django.template import loader
|
|||||||
from django.shortcuts import get_object_or_404, render
|
from django.shortcuts import get_object_or_404, render
|
||||||
from .models import *
|
from .models import *
|
||||||
from .forms import *
|
from .forms import *
|
||||||
|
from django.db.models import Q
|
||||||
import re
|
import re
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
@ -29,8 +30,8 @@ def reservation(request):
|
|||||||
|
|
||||||
template = loader.get_template('reservation.html')
|
template = loader.get_template('reservation.html')
|
||||||
error = ""
|
error = ""
|
||||||
reservation = Reservation.objects.filter(room_number=room_number).filter(begin_date__gte=begin_date).filter(end_date__lte=end_date)
|
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 reservation:
|
if not reservation is None:
|
||||||
status = "Pokój " + str(room_number) + " jest już zarezerwowany"
|
status = "Pokój " + str(room_number) + " jest już zarezerwowany"
|
||||||
return HttpResponse(template.render({'status': status}, request))
|
return HttpResponse(template.render({'status': status}, request))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user