format daty + sortowanie + wyglad w tabeli
This commit is contained in:
parent
ffd81453b7
commit
7f0efb044e
BIN
hotel/db.sqlite3
BIN
hotel/db.sqlite3
Binary file not shown.
Binary file not shown.
1311
hotel/rooms/static/jquery-ui.css
vendored
Normal file
1311
hotel/rooms/static/jquery-ui.css
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@ -3,8 +3,11 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'style.css' %}">
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'jquery-ui.css' %}">
|
||||
<meta charset="UTF-8">
|
||||
<title>Hotel INO Scrum</title>
|
||||
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
|
||||
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
|
||||
<script>
|
||||
function changeBackground(imageUrl) {
|
||||
if(imageUrl != null) {
|
||||
@ -13,6 +16,10 @@
|
||||
localStorage.backgroundImage = imageUrl;
|
||||
}
|
||||
}
|
||||
|
||||
$( function() {
|
||||
$( ".datepicker" ).datepicker({ dateFormat: 'dd-mm-yy' }).val();
|
||||
} );
|
||||
</script>
|
||||
</head>
|
||||
<body onLoad="changeBackground(imageUrl = localStorage.backgroundImage)">
|
||||
@ -39,8 +46,8 @@
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="room" value="{{ room.room_number }}">
|
||||
<div class="button-box" >
|
||||
Od: <input type="date" name="begindate">
|
||||
Do: <input type="date" name="enddate"><br>
|
||||
Od: <input type="text" class="datepicker" name="begindate" size="3">
|
||||
Do: <input type="text" class="datepicker" name="enddate" size="3">
|
||||
<button>Rezerwuj</button>
|
||||
</div>
|
||||
</form>
|
||||
|
@ -12,7 +12,7 @@ import datetime
|
||||
|
||||
def index(request):
|
||||
rooms = Room.objects.all()
|
||||
rooms = rooms.order_by('room_number')
|
||||
rooms = rooms.order_by('room_type', 'room_number')
|
||||
template = loader.get_template('index.html')
|
||||
|
||||
return HttpResponse(template.render({'rooms': rooms}, request))
|
||||
@ -21,8 +21,8 @@ def index(request):
|
||||
def reservation(request):
|
||||
room_number, begin_date, end_date = request.POST['room'], request.POST['begindate'], request.POST['enddate']
|
||||
try:
|
||||
begin_datetime = datetime.datetime.strptime(begin_date, "%Y-%m-%d")
|
||||
end_datetime = datetime.datetime.strptime(end_date, "%Y-%m-%d")
|
||||
begin_datetime = datetime.datetime.strptime(begin_date, "%d-%m-%Y")
|
||||
end_datetime = datetime.datetime.strptime(end_date, "%d-%m-%Y")
|
||||
except:
|
||||
return HttpResponse(loader.get_template('error.html').render({'error': "Błąd przy datach"}, request))
|
||||
if begin_datetime == '' or end_datetime == '' or end_datetime < begin_datetime or begin_datetime < datetime.datetime.today() or end_datetime < datetime.datetime.today():
|
||||
|
Loading…
Reference in New Issue
Block a user