Compare commits
27 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
bc2db30129 | ||
|
570463a30b | ||
3d4a87e629 | |||
56eeed0f98 | |||
ebff9c20c6 | |||
|
a8e670c996 | ||
bce5c78d35 | |||
|
6affb9915b | ||
|
e3bb9dd669 | ||
|
7f0efb044e | ||
|
ffd81453b7 | ||
|
646e675910 | ||
|
037ab2737a | ||
|
50b7135472 | ||
|
f8a6127c11 | ||
|
71595d5af2 | ||
|
57520b10fa | ||
|
6eb98b1b22 | ||
|
79787db1a5 | ||
4257fd0567 | |||
f48b8d7158 | |||
|
e36992bc3f | ||
|
531adcee2e | ||
|
316043e17f | ||
|
4a7996a075 | ||
|
8f2563c734 | ||
|
8ae157c04b |
BIN
db.sqlite3
BIN
hotel/db.sqlite3
BIN
hotel/hotel/__pycache__/__init__.cpython-37.pyc
Normal file
BIN
hotel/hotel/__pycache__/settings.cpython-37.pyc
Normal file
BIN
hotel/hotel/__pycache__/urls.cpython-37.pyc
Normal file
BIN
hotel/hotel/__pycache__/wsgi.cpython-37.pyc
Normal file
@ -12,6 +12,8 @@ https://docs.djangoproject.com/en/2.1/ref/settings/
|
||||
|
||||
import os
|
||||
|
||||
|
||||
|
||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
@ -104,13 +106,13 @@ AUTH_PASSWORD_VALIDATORS = [
|
||||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/2.1/topics/i18n/
|
||||
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
LANGUAGE_CODE = 'pl'
|
||||
|
||||
TIME_ZONE = 'UTC'
|
||||
|
||||
USE_I18N = True
|
||||
USE_I18N = False
|
||||
|
||||
USE_L10N = True
|
||||
USE_L10N = False
|
||||
|
||||
USE_TZ = True
|
||||
|
||||
@ -119,3 +121,5 @@ USE_TZ = True
|
||||
# https://docs.djangoproject.com/en/2.1/howto/static-files/
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
|
||||
|
||||
|
BIN
hotel/rooms/__pycache__/__init__.cpython-37.pyc
Normal file
BIN
hotel/rooms/__pycache__/admin.cpython-37.pyc
Normal file
BIN
hotel/rooms/__pycache__/apps.cpython-37.pyc
Normal file
BIN
hotel/rooms/__pycache__/forms.cpython-35.pyc
Normal file
BIN
hotel/rooms/__pycache__/forms.cpython-36.pyc
Normal file
BIN
hotel/rooms/__pycache__/forms.cpython-37.pyc
Normal file
BIN
hotel/rooms/__pycache__/models.cpython-37.pyc
Normal file
BIN
hotel/rooms/__pycache__/urls.cpython-37.pyc
Normal file
BIN
hotel/rooms/__pycache__/views.cpython-37.pyc
Normal file
@ -3,4 +3,6 @@ from .models import *
|
||||
|
||||
admin.site.register(Room)
|
||||
admin.site.register(RoomType)
|
||||
admin.site.register(Reservation)
|
||||
admin.site.register(Client)
|
||||
|
||||
|
23
hotel/rooms/forms.py
Normal file
@ -0,0 +1,23 @@
|
||||
from django.forms import ModelForm
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from .models import *
|
||||
|
||||
|
||||
class ClientForm(ModelForm):
|
||||
|
||||
class Meta:
|
||||
|
||||
model = Client
|
||||
fields = '__all__'
|
||||
labels = {
|
||||
'id_number': _('Numer dowodu '),
|
||||
'name': _('Imię '),
|
||||
'surname': _('Nazwisko ')
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(ClientForm, self).__init__(*args, **kwargs)
|
||||
self.fields['id_number'].error_messages = {'required': 'custom required message'}
|
||||
|
||||
|
||||
|
32
hotel/rooms/migrations/0005_client_reservation.py
Normal file
@ -0,0 +1,32 @@
|
||||
# Generated by Django 2.1.5 on 2019-01-20 11:06
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('rooms', '0004_auto_20190112_2307'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Client',
|
||||
fields=[
|
||||
('id_number', models.CharField(max_length=9, primary_key=True, serialize=False)),
|
||||
('name', models.CharField(max_length=40)),
|
||||
('surname', models.CharField(max_length=40)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Reservation',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('begin_date', models.DateField()),
|
||||
('end_date', models.DateField()),
|
||||
('client_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='rooms.Client')),
|
||||
('room_number', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='rooms.Room')),
|
||||
],
|
||||
),
|
||||
]
|
17
hotel/rooms/migrations/0006_remove_room_reserved.py
Normal file
@ -0,0 +1,17 @@
|
||||
# Generated by Django 2.1.5 on 2019-01-22 20:01
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('rooms', '0005_client_reservation'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='room',
|
||||
name='reserved',
|
||||
),
|
||||
]
|
BIN
hotel/rooms/migrations/__pycache__/0001_initial.cpython-37.pyc
Normal file
BIN
hotel/rooms/migrations/__pycache__/__init__.cpython-37.pyc
Normal file
@ -1,5 +1,5 @@
|
||||
from django.db import models
|
||||
from django.core.validators import MinValueValidator
|
||||
from django.core.validators import MinValueValidator, RegexValidator
|
||||
|
||||
|
||||
class RoomType(models.Model):
|
||||
@ -24,7 +24,24 @@ class Room(models.Model):
|
||||
)
|
||||
|
||||
room_type = models.ForeignKey(RoomType, on_delete=models.CASCADE)
|
||||
reserved = models.BooleanField()
|
||||
|
||||
def __str__(self):
|
||||
return str(self.room_number)
|
||||
|
||||
|
||||
class Client(models.Model):
|
||||
id_number = models.CharField(max_length=9,
|
||||
primary_key=True)
|
||||
name = models.CharField(max_length=40)
|
||||
surname = models.CharField(max_length=40)
|
||||
|
||||
def __str__(self):
|
||||
return self.name + self.surname
|
||||
|
||||
|
||||
class Reservation(models.Model):
|
||||
room_number = models.ForeignKey(Room, on_delete=models.CASCADE)
|
||||
client_id = models.ForeignKey(Client, on_delete=models.CASCADE)
|
||||
begin_date = models.DateField()
|
||||
end_date = models.DateField()
|
||||
|
||||
|
Before Width: | Height: | Size: 1.5 MiB |
BIN
hotel/rooms/static/images/background1.jpg
Normal file
After Width: | Height: | Size: 559 KiB |
BIN
hotel/rooms/static/images/background2.jpg
Normal file
After Width: | Height: | Size: 451 KiB |
BIN
hotel/rooms/static/images/background3.jpg
Normal file
After Width: | Height: | Size: 676 KiB |
BIN
hotel/rooms/static/images/background4.jpg
Normal file
After Width: | Height: | Size: 633 KiB |
BIN
hotel/rooms/static/images/background5.jpg
Normal file
After Width: | Height: | Size: 939 KiB |
BIN
hotel/rooms/static/images/ui-icons_444444_256x240.png
Normal file
After Width: | Height: | Size: 6.8 KiB |
BIN
hotel/rooms/static/images/ui-icons_555555_256x240.png
Normal file
After Width: | Height: | Size: 6.9 KiB |
BIN
hotel/rooms/static/images/ui-icons_777620_256x240.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
hotel/rooms/static/images/ui-icons_777777_256x240.png
Normal file
After Width: | Height: | Size: 6.8 KiB |
BIN
hotel/rooms/static/images/ui-icons_cc0000_256x240.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
hotel/rooms/static/images/ui-icons_ffffff_256x240.png
Normal file
After Width: | Height: | Size: 6.2 KiB |
1311
hotel/rooms/static/jquery-ui.css
vendored
Normal file
@ -22,11 +22,19 @@
|
||||
color: white;
|
||||
}
|
||||
|
||||
html {
|
||||
background: url(images/background.jpg) no-repeat center center fixed;
|
||||
-webkit-background-size: cover;
|
||||
-moz-background-size: cover;
|
||||
-o-background-size: cover;
|
||||
#images {
|
||||
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
|
||||
border-collapse: collapse;
|
||||
background-color: white;
|
||||
}
|
||||
|
||||
#images th {
|
||||
border: 1px solid #ddd;
|
||||
padding: 12px;
|
||||
}
|
||||
|
||||
body {
|
||||
background: url(images/background5.jpg) no-repeat center center fixed;
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
@ -48,3 +56,25 @@ a {
|
||||
padding: 30px;
|
||||
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;
|
||||
}
|
||||
#page {
|
||||
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
|
||||
display:inline-block;
|
||||
color: #444;
|
||||
border: 1px solid #CCC;
|
||||
background: #efefef;
|
||||
box-shadow: 0 0 5px -1px rgba(0,0,0,0.2);
|
||||
cursor: pointer;
|
||||
vertical-align: middle;
|
||||
max-width: 100px;
|
||||
padding: 5px;
|
||||
text-align: center;
|
||||
}
|
||||
|
28
hotel/rooms/templates/error.html
Normal file
@ -0,0 +1,28 @@
|
||||
{% load static %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'style.css' %}">
|
||||
<meta charset="UTF-8">
|
||||
<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>
|
||||
<body onLoad="changeBackground(imageUrl = 'static/images/background5.jpg')">
|
||||
<br>
|
||||
<center>
|
||||
<div id="reservationbox">
|
||||
{{ error }}
|
||||
</div>
|
||||
<br>
|
||||
<a href="{% url 'index' %}"><button>Wróć na stronę główną</button></a>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
45
hotel/rooms/templates/form.html
Normal file
@ -0,0 +1,45 @@
|
||||
{% load static %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'style.css' %}">
|
||||
<meta charset="UTF-8">
|
||||
<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>
|
||||
<body onLoad="changeBackground(imageUrl = 'static/images/background5.jpg')">
|
||||
<br>
|
||||
<center>
|
||||
<h1>Formularz rezerwacji</h1>
|
||||
<div id="reservationform">
|
||||
<form action="" method="post">
|
||||
{{ error }}
|
||||
{% csrf_token %}
|
||||
<table>
|
||||
<th><th>
|
||||
{% for field in form %}
|
||||
<tr>
|
||||
<td>{{ field.label }}</td>
|
||||
<td></td><td></td><td></td><td></td>
|
||||
<td>{{ field }}</td>
|
||||
</tr>
|
||||
<tr></tr><tr></tr><tr></tr><tr></tr><tr></tr><tr></tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
<input type="hidden" name="room" value="{{ room_number }}">
|
||||
<input type="hidden" name="begindate" value="{{ begin_date }}">
|
||||
<input type="hidden" name="enddate" value="{{ end_date }}">
|
||||
<input type="submit" value="Rezerwuj">
|
||||
</form>
|
||||
</center>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -3,13 +3,65 @@
|
||||
<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) {
|
||||
document.body.style.background = "url(" + imageUrl + ") no-repeat center center fixed";
|
||||
document.body.style.backgroundSize = "cover";
|
||||
localStorage.backgroundImage = imageUrl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
$( function() {
|
||||
$( ".datepicker" ).datepicker({ dateFormat: 'dd-mm-yy' }).val();
|
||||
|
||||
$( ".dateform" ).submit(function(event){
|
||||
|
||||
var begindate = $(this).find('input[name=begindate]').val().split("-");
|
||||
var enddate = $(this).find('input[name=enddate]').val().split("-");
|
||||
|
||||
var todayTime = new Date();
|
||||
var dd = today.getDate();
|
||||
var mm = today.getMonth();
|
||||
var yyyy = today.getFullYear();
|
||||
var today = new Date(yyyy, mm, dd);
|
||||
begindate = new Date(begindate[2], begindate[1] - 1, begindate[0]);
|
||||
enddate = new Date(enddate[2], enddate[1] - 1, enddate[0]);
|
||||
if (begindate.getTime() < today.getTime()){
|
||||
alert('Data początkowa jest z przeszłości');
|
||||
return false;
|
||||
}
|
||||
if (enddate.getTime() < today.getTime()){
|
||||
alert('Data końcowa jest z przeszłości');
|
||||
return false;
|
||||
}
|
||||
if (begindate.getTime() > enddate.getTime()){
|
||||
alert('Data końcowa jest przed początkową');
|
||||
return false;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
} );
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<body onLoad="changeBackground(imageUrl = 'static/images/background5.jpg')">
|
||||
<h1>Hotel INO Scrum</h1>
|
||||
<center><h3>Lista pokoi dostępnych w naszym hotelu</h3></center>
|
||||
<center><h3>{{ error }}</h3></center>
|
||||
<table id="hotels">
|
||||
<col style="width:10%">
|
||||
<col style="width:30%">
|
||||
<col style="width:15%">
|
||||
<col style="width:45%">
|
||||
<th>Numer pokoju</th>
|
||||
<th>Typ pokoju</th>
|
||||
<th>Cena</th>
|
||||
@ -20,27 +72,35 @@
|
||||
<td>{{ room.room_type }}</td>
|
||||
<td>{{ room.price }} zł</td>
|
||||
<td>
|
||||
{% if room.reserved %}
|
||||
<form action="{% url 'reservation' %}" method="POST">
|
||||
|
||||
<form action="{% url 'reservation' %}" class="dateform" method="POST">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="room" value="{{ room.room_number }}">
|
||||
<div class="button-box" >
|
||||
Od: <input type="text" class="datepicker" name="begindate" size="6" required>
|
||||
Do: <input type="text" class="datepicker" name="enddate" size="6" required>
|
||||
<button>Rezerwuj</button>
|
||||
</div>
|
||||
</form>
|
||||
{% else %}
|
||||
<form action="{% url 'reservation' %}" method="POST">
|
||||
{% csrf_token %}
|
||||
<input type="hidden" name="room" value="{{ room.room_number }}">
|
||||
<div class="button-box" >
|
||||
<button>Rezerwuj</button>
|
||||
</div>
|
||||
</form>
|
||||
{% endif %}
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
<br>
|
||||
<center>
|
||||
{% if firstpage == False %}
|
||||
<a href="{% url 'indexpage' currentpage|add:'-1' %}"><button id="page"><<</button></a>
|
||||
{% endif %}
|
||||
|
||||
{% for p in pages %}
|
||||
<a href="{% url 'indexpage' p %}"><div id="page">{{ p }}</div></a>
|
||||
{% endfor %}
|
||||
|
||||
{% if lastpage == False %}
|
||||
<a href="{% url 'indexpage' currentpage|add:'+1' %}"><button id="page">>></button></a>
|
||||
{% endif %}
|
||||
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -4,9 +4,18 @@
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'style.css' %}">
|
||||
<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>
|
||||
<body>
|
||||
<body onLoad="changeBackground(imageUrl = 'static/images/background5.jpg')">
|
||||
<br>
|
||||
<center>
|
||||
<div id="reservationbox">
|
||||
|
@ -4,5 +4,6 @@ from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path('', views.index, name='index'),
|
||||
path('<int:page>', views.index, name='indexpage'),
|
||||
path('reservation', views.reservation, name='reservation')
|
||||
]
|
@ -2,25 +2,102 @@ from django.http import HttpResponse
|
||||
from django.template import loader
|
||||
from django.shortcuts import get_object_or_404, render
|
||||
from .models import *
|
||||
from .forms import *
|
||||
from django.db.models import Q
|
||||
import datetime
|
||||
import math
|
||||
import re
|
||||
|
||||
# Create your views here.
|
||||
|
||||
|
||||
def index(request):
|
||||
rooms = Room.objects.all()
|
||||
template = loader.get_template('index.html')
|
||||
def index(request, page=1):
|
||||
first_page, last_page = False, False
|
||||
if page == 1:
|
||||
first_page = True
|
||||
|
||||
return HttpResponse(template.render({'rooms': rooms}, request))
|
||||
rooms = Room.objects.all()
|
||||
rooms = rooms.order_by('room_type', 'room_number')
|
||||
|
||||
if page*10 >= len(rooms):
|
||||
last_page = True
|
||||
|
||||
max_pages = math.ceil(len(rooms)/10)
|
||||
|
||||
rooms = rooms[10*(page-1):10*page]
|
||||
template = loader.get_template('index.html')
|
||||
return HttpResponse(template.render({'rooms': rooms,
|
||||
'firstpage': first_page,
|
||||
'lastpage': last_page,
|
||||
'pages': range(1,max_pages+1),
|
||||
'currentpage': page}, request))
|
||||
|
||||
|
||||
def reservation(request):
|
||||
room = get_object_or_404(Room, room_number=request.POST['room'])
|
||||
room_number, begin_date, end_date = request.POST['room'], request.POST['begindate'], request.POST['enddate']
|
||||
begin_datetime = datetime.datetime.strptime(begin_date, "%d-%m-%Y")
|
||||
end_datetime = datetime.datetime.strptime(end_date, "%d-%m-%Y")
|
||||
clientform = {}
|
||||
template = loader.get_template('reservation.html')
|
||||
if not room.reserved:
|
||||
room.reserved = True
|
||||
room.save()
|
||||
status = "Pokój " + str(room) + " zarezerwowany pomyślnie"
|
||||
else:
|
||||
status = "Pokój " + str(room) + " jest już zarezerwowany"
|
||||
error = ""
|
||||
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 not reservation is None:
|
||||
status = "Pokój " + str(room_number) + " jest zajęty"
|
||||
return HttpResponse(template.render({'status': status}, request))
|
||||
|
||||
else:
|
||||
if request.method == "POST":
|
||||
begin = datetime.datetime.strptime(begin_date, "%d-%m-%Y")
|
||||
end = datetime.datetime.strptime(end_date, "%d-%m-%Y")
|
||||
client_id = request.POST.get('id_number', False)
|
||||
if client_id:
|
||||
|
||||
client = ClientForm(request.POST)
|
||||
if client.is_valid():
|
||||
id_number = client.cleaned_data['id_number']
|
||||
clientform = {'id_number': client.cleaned_data['id_number'],
|
||||
'name': client.cleaned_data['name'],
|
||||
'surname': client.cleaned_data['surname']}
|
||||
if check(id_number):
|
||||
if Client.objects.filter(id_number=client_id).first() is None:
|
||||
client.save()
|
||||
else:
|
||||
error = "Zły numer dowodu"
|
||||
form = ClientForm(initial=clientform)
|
||||
template = loader.get_template('form.html')
|
||||
return HttpResponse(template.render({'form': form,
|
||||
'error': error,
|
||||
'room_number': room_number,
|
||||
'begin_date': begin_date,
|
||||
'end_date': end_date}, 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
|
||||
r.end_date = end
|
||||
r.save()
|
||||
|
||||
status = "Pokój " + str(room_number) + " został pomyślnie zarezerwowany"
|
||||
|
||||
return HttpResponse(template.render({'status': status}, request))
|
||||
|
||||
else:
|
||||
pass
|
||||
|
||||
form = ClientForm(initial=clientform)
|
||||
template = loader.get_template('form.html')
|
||||
return HttpResponse(template.render({'form': form,
|
||||
'error': error,
|
||||
'room_number': room_number,
|
||||
'begin_date': begin_date,
|
||||
'end_date': end_date}, request))
|
||||
|
||||
def check(numer):
|
||||
pattern = re.compile(r'[A-Z][A-Z][A-Z]\d\d\d\d\d\d')
|
||||
|
||||
return pattern.match(numer)
|
||||
|
||||
|
||||
|
||||
|
||||
return HttpResponse(template.render({'status': status}, request))
|
15
manage.py
@ -1,15 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
import os
|
||||
import sys
|
||||
|
||||
if __name__ == '__main__':
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'hotel.settings')
|
||||
try:
|
||||
from django.core.management import execute_from_command_line
|
||||
except ImportError as exc:
|
||||
raise ImportError(
|
||||
"Couldn't import Django. Are you sure it's installed and "
|
||||
"available on your PYTHONPATH environment variable? Did you "
|
||||
"forget to activate a virtual environment?"
|
||||
) from exc
|
||||
execute_from_command_line(sys.argv)
|
BIN
requirements.txt
126
settings.py
@ -1,126 +0,0 @@
|
||||
"""
|
||||
Django settings for hotel project.
|
||||
|
||||
Generated by 'django-admin startproject' using Django 2.1.5.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/2.1/topics/settings/
|
||||
|
||||
For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/2.1/ref/settings/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
import django_heroku
|
||||
|
||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
|
||||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/2.1/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = 'qjkrranvqc3a+8!+6p4pxlk(w3dvuzt#dab1k2ajuqe+xza2@a'
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
|
||||
ALLOWED_HOSTS = []
|
||||
|
||||
|
||||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'rooms.apps.RoomsConfig',
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles'
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'hotel.urls'
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [],
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
'django.template.context_processors.debug',
|
||||
'django.template.context_processors.request',
|
||||
'django.contrib.auth.context_processors.auth',
|
||||
'django.contrib.messages.context_processors.messages',
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
WSGI_APPLICATION = 'hotel.wsgi.application'
|
||||
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/2.1/ref/settings/#databases
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/2.1/ref/settings/#auth-password-validators
|
||||
|
||||
AUTH_PASSWORD_VALIDATORS = [
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
|
||||
},
|
||||
]
|
||||
|
||||
|
||||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/2.1/topics/i18n/
|
||||
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
|
||||
TIME_ZONE = 'UTC'
|
||||
|
||||
USE_I18N = True
|
||||
|
||||
USE_L10N = True
|
||||
|
||||
USE_TZ = True
|
||||
|
||||
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/2.1/howto/static-files/
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
|
||||
# Activate Django-Heroku.
|
||||
django_heroku.settings(locals())
|