walidacja formularza

This commit is contained in:
Hokan 2019-01-22 20:28:51 +01:00
commit 57520b10fa
11 changed files with 59 additions and 13 deletions

Binary file not shown.

Binary file not shown.

View File

@ -9,7 +9,13 @@ class ClientForm(ModelForm):
model = Client model = Client
fields = '__all__' fields = '__all__'
labels = { labels = {
<<<<<<< HEAD
'id_number': 'Numer dowodu: ', 'id_number': 'Numer dowodu: ',
'name': 'Imię: ', 'name': 'Imię: ',
'surname': 'Nazwisko: ' 'surname': 'Nazwisko: '
=======
'id_number': _('Numer dowodu '),
'name': _('Imię '),
'surname': _('Nazwisko ')
>>>>>>> 79787db1a58d1e3a363982eba9f484be10a87aaf
} }

View File

@ -56,3 +56,12 @@ a {
padding: 30px; padding: 30px;
border: 2px solid grey; border: 2px solid grey;
} }
#reservationform {
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
font-size: 30px;
background-color: white;
color: black;
width: 40%;
padding: 10px;
border: 2px solid grey;
}

View File

@ -4,14 +4,29 @@
<head> <head>
<link rel="stylesheet" type="text/css" href="{% static 'style.css' %}"> <link rel="stylesheet" type="text/css" href="{% static 'style.css' %}">
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Title</title> <title>Formularz rezerwacji</title>
<script>
function changeBackground(imageUrl) {
if(imageUrl != null) {
document.body.style.background = "url(" + imageUrl + ") no-repeat center center fixed";
document.body.style.backgroundSize = "cover";
localStorage.backgroundImage = imageUrl;
}
}
</script>
</head> </head>
<body> <body onLoad="changeBackground(imageUrl = localStorage.backgroundImage)">
<br>
<center>
<h1>Formularz rezerwacji</h1>
<div id="reservationform">
<form action="" method="post"> <form action="" method="post">
{{ error }} {{ error }}
{% csrf_token %} {% csrf_token %}
{{ form.as_p }} {{ form.as_p }}
<input type="submit" value="Submit"> <input type="submit" value="Rezerwuj">
</form> </form>
</center>
</div>
</body> </body>
</html> </html>

View File

@ -7,19 +7,22 @@
<title>Hotel INO Scrum</title> <title>Hotel INO Scrum</title>
<script> <script>
function changeBackground(imageUrl) { function changeBackground(imageUrl) {
document.body.style.background = "url(" + imageUrl + ") no-repeat center center fixed"; if(imageUrl != null) {
document.body.style.backgroundSize = "cover"; document.body.style.background = "url(" + imageUrl + ") no-repeat center center fixed";
document.body.style.backgroundSize = "cover";
localStorage.backgroundImage = imageUrl;
}
} }
</script> </script>
</head> </head>
<body> <body onLoad="changeBackground(imageUrl = localStorage.backgroundImage)">
<h1>Hotel INO Scrum</h1> <h1>Hotel INO Scrum</h1>
<center><h3>Lista pokoi dostępnych w naszym hotelu</h3></center> <center><h3>Lista pokoi dostępnych w naszym hotelu</h3></center>
<table id="hotels"> <table id="hotels">
<col style="width:10%"> <col style="width:10%">
<col style="width:30%"> <col style="width:30%">
<col style="width:20%"> <col style="width:25%">
<col style="width:40%"> <col style="width:35%">
<th>Numer pokoju</th> <th>Numer pokoju</th>
<th>Typ pokoju</th> <th>Typ pokoju</th>
<th>Cena</th> <th>Cena</th>
@ -35,7 +38,9 @@
{% csrf_token %} {% csrf_token %}
<input type="hidden" name="room" value="{{ room.room_number }}"> <input type="hidden" name="room" value="{{ room.room_number }}">
<div class="button-box" > <div class="button-box" >
<button>Rezerwuj</button> <button>Rezerwuj</button><br>
<input type="date" name="begindate">
<input type="date" name="enddate">
</div> </div>
</form> </form>
{% else %} {% else %}
@ -43,7 +48,9 @@
{% csrf_token %} {% csrf_token %}
<input type="hidden" name="room" value="{{ room.room_number }}"> <input type="hidden" name="room" value="{{ room.room_number }}">
<div class="button-box" > <div class="button-box" >
<button>Rezerwuj</button> <button>Rezerwuj</button><br>
<input type="date" name="begindate">
<input type="date" name="enddate">
</div> </div>
</form> </form>
{% endif %} {% endif %}

View File

@ -4,9 +4,18 @@
<head> <head>
<link rel="stylesheet" type="text/css" href="{% static 'style.css' %}"> <link rel="stylesheet" type="text/css" href="{% static 'style.css' %}">
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>Zarezerwowano pokój</title> <title>Rezerwacja</title>
<script>
function changeBackground(imageUrl) {
if(imageUrl != null) {
document.body.style.background = "url(" + imageUrl + ") no-repeat center center fixed";
document.body.style.backgroundSize = "cover";
localStorage.backgroundImage = imageUrl;
}
}
</script>
</head> </head>
<body> <body onLoad="changeBackground(imageUrl = localStorage.backgroundImage)">
<br> <br>
<center> <center>
<div id="reservationbox"> <div id="reservationbox">