fix fixa rezerwacji
This commit is contained in:
parent
037ab2737a
commit
646e675910
BIN
hotel/db.sqlite3
BIN
hotel/db.sqlite3
Binary file not shown.
Binary file not shown.
@ -30,7 +30,6 @@ def reservation(request):
|
||||
template = loader.get_template('reservation.html')
|
||||
error = ""
|
||||
reservation = Reservation.objects.filter(room_number=room_number).filter(begin_date__gte=begin_date).filter(end_date__lte=end_date)
|
||||
print(reservation)
|
||||
if reservation:
|
||||
status = "Pokój " + str(room_number) + " jest już zarezerwowany"
|
||||
return HttpResponse(template.render({'status': status}, request))
|
||||
@ -39,11 +38,10 @@ def reservation(request):
|
||||
if request.method == "POST":
|
||||
try:
|
||||
client_id = request.POST['id_number']
|
||||
if check(client_id):
|
||||
instance = Client.objects.get(id_number=client_id)
|
||||
client = ClientForm(request.POST, instance=instance)
|
||||
|
||||
if not Client.objects.get(id_number=client_id):
|
||||
if check(client_id):
|
||||
if Client.objects.filter(id_number=client_id).first() is None:
|
||||
client = ClientForm(request.POST)
|
||||
client.save()
|
||||
|
||||
r = Reservation()
|
||||
|
Loading…
Reference in New Issue
Block a user