fix formularza klienta

This commit is contained in:
Hokan 2019-01-30 22:41:22 +01:00
parent 3d4a87e629
commit 570463a30b
3 changed files with 5 additions and 3 deletions

Binary file not shown.

View File

@ -48,7 +48,8 @@ def reservation(request):
else:
if request.method == "POST":
begin = datetime.datetime.strptime(begin_date, "%d-%m-%Y")
end = datetime.datetime.strptime(end_date, "%d-%m-%Y")
try:
client_id = request.POST['id_number']
@ -66,11 +67,12 @@ def reservation(request):
r = Reservation()
r.room_number = get_object_or_404(Room, room_number=room_number)
r.client_id = get_object_or_404(Client, id_number=client_id)
r.begin_date = begin_date
r.end_date = end_date
r.begin_date = begin
r.end_date = end
r.save()
status = "Pokój " + str(room_number) + " został pomyślnie zarezerwowany"
return HttpResponse(template.render({'status': status}, request))
else:
error = "Zły numer dowodu"