diff --git a/hotel/rooms/__pycache__/forms.cpython-35.pyc b/hotel/rooms/__pycache__/forms.cpython-35.pyc new file mode 100644 index 0000000..8d32f1f Binary files /dev/null and b/hotel/rooms/__pycache__/forms.cpython-35.pyc differ diff --git a/hotel/rooms/__pycache__/models.cpython-35.pyc b/hotel/rooms/__pycache__/models.cpython-35.pyc index 386b93f..32e0797 100644 Binary files a/hotel/rooms/__pycache__/models.cpython-35.pyc and b/hotel/rooms/__pycache__/models.cpython-35.pyc differ diff --git a/hotel/rooms/__pycache__/urls.cpython-35.pyc b/hotel/rooms/__pycache__/urls.cpython-35.pyc index 5aa9817..20fb127 100644 Binary files a/hotel/rooms/__pycache__/urls.cpython-35.pyc and b/hotel/rooms/__pycache__/urls.cpython-35.pyc differ diff --git a/hotel/rooms/__pycache__/views.cpython-35.pyc b/hotel/rooms/__pycache__/views.cpython-35.pyc index acb1b9e..e082e3e 100644 Binary files a/hotel/rooms/__pycache__/views.cpython-35.pyc and b/hotel/rooms/__pycache__/views.cpython-35.pyc differ diff --git a/hotel/rooms/forms.py b/hotel/rooms/forms.py new file mode 100644 index 0000000..05e3220 --- /dev/null +++ b/hotel/rooms/forms.py @@ -0,0 +1,15 @@ +from django.forms import ModelForm +from django.utils.translation import gettext_lazy as _ +from .models import * +from django import forms + + +class ClientForm(ModelForm): + class Meta: + model = Client + fields = '__all__' + labels = { + 'id_number': _('Numer dowodu: '), + 'name': _('Imię: '), + 'surname': _('Nazwisko: ') + } diff --git a/hotel/rooms/models.py b/hotel/rooms/models.py index add9c0e..98e320d 100644 --- a/hotel/rooms/models.py +++ b/hotel/rooms/models.py @@ -28,3 +28,19 @@ class Room(models.Model): 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() \ No newline at end of file diff --git a/hotel/rooms/templates/form.html b/hotel/rooms/templates/form.html new file mode 100644 index 0000000..9f9fd00 --- /dev/null +++ b/hotel/rooms/templates/form.html @@ -0,0 +1,16 @@ +{% load static %} + + +
+ + +