diff --git a/hotel/hotel/__pycache__/settings.cpython-35.pyc b/hotel/hotel/__pycache__/settings.cpython-35.pyc index f66667c..3f7dbac 100644 Binary files a/hotel/hotel/__pycache__/settings.cpython-35.pyc and b/hotel/hotel/__pycache__/settings.cpython-35.pyc differ diff --git a/hotel/hotel/settings.py b/hotel/hotel/settings.py index ad7d397..3650f1c 100644 --- a/hotel/hotel/settings.py +++ b/hotel/hotel/settings.py @@ -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/' + + diff --git a/hotel/rooms/__pycache__/forms.cpython-35.pyc b/hotel/rooms/__pycache__/forms.cpython-35.pyc index 596beb8..d3e4ce7 100644 Binary files a/hotel/rooms/__pycache__/forms.cpython-35.pyc and b/hotel/rooms/__pycache__/forms.cpython-35.pyc differ diff --git a/hotel/rooms/__pycache__/views.cpython-35.pyc b/hotel/rooms/__pycache__/views.cpython-35.pyc index 5e3deb2..8d96363 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 index f3be152..4c931f2 100644 --- a/hotel/rooms/forms.py +++ b/hotel/rooms/forms.py @@ -4,7 +4,9 @@ from .models import * class ClientForm(ModelForm): + class Meta: + model = Client fields = '__all__' labels = { @@ -13,4 +15,9 @@ class ClientForm(ModelForm): 'surname': _('Nazwisko ') } + def __init__(self, *args, **kwargs): + super(ClientForm, self).__init__(*args, **kwargs) + self.fields['id_number'].error_messages = {'required': 'custom required message'} + + diff --git a/hotel/rooms/templates/index.html b/hotel/rooms/templates/index.html index c88e0da..1912f4a 100644 --- a/hotel/rooms/templates/index.html +++ b/hotel/rooms/templates/index.html @@ -24,22 +24,21 @@ $( ".dateform" ).submit(function(event){ - var begindate = $(this).find('input[name=begindate]').val(); - var enddate = $(this).find('input[name=enddate]').val(); - var beginpop = $(this).find('[name=beginPopup]'); - var endpop = $(this).find('[name=endPopup]'); - beginpop.addClass('popup') - var today = $.datepicker.formatDate('dd-mm-yy', new Date()); + var begindate = $(this).find('input[name=begindate]').val().split("-"); + var enddate = $(this).find('input[name=enddate]').val().split("-"); - if (begindate.getDate() < today.getDate()){ + var today = new Date(); + 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.getDate() < today.getDate()){ + if (enddate.getTime() < today.getTime()){ alert('Data końcowa jest z przeszłości'); return false; } - if (begindate.getDate() > enddate.getDate()){ + if (begindate.getTime() > enddate.getTime()){ alert('Data końcowa jest przed początkową'); return false; }