code cleanup
This commit is contained in:
3
.idea/workspace.xml
generated
3
.idea/workspace.xml
generated
@@ -3,8 +3,11 @@
|
|||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="15f590a5-5017-44f1-a85e-17dfe3fc5379" name="Default Changelist" comment="">
|
<list default="true" id="15f590a5-5017-44f1-a85e-17dfe3fc5379" name="Default Changelist" comment="">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/config/urls.py" beforeDir="false" afterPath="$PROJECT_DIR$/config/urls.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/templates/base.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/base.html" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/templates/inputhours.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/inputhours.html" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/templates/inputhours.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/inputhours.html" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/work/forms.py" beforeDir="false" afterPath="$PROJECT_DIR$/work/forms.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/work/forms.py" beforeDir="false" afterPath="$PROJECT_DIR$/work/forms.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/work/models.py" beforeDir="false" afterPath="$PROJECT_DIR$/work/models.py" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/work/views.py" beforeDir="false" afterPath="$PROJECT_DIR$/work/views.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/work/views.py" beforeDir="false" afterPath="$PROJECT_DIR$/work/views.py" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||||
|
|||||||
Binary file not shown.
@@ -15,19 +15,14 @@ Including another URLconf
|
|||||||
"""
|
"""
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.urls import path, include
|
from django.urls import path, include
|
||||||
from django.views.generic.base import TemplateView
|
|
||||||
from work import views
|
from work import views
|
||||||
from accounts import views as accounts_views
|
from accounts import views as accounts_views
|
||||||
from django.conf.urls import url
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('admin/', admin.site.urls),
|
path('admin/', admin.site.urls),
|
||||||
path('accounts/', include('django.contrib.auth.urls')),
|
path('accounts/', include('django.contrib.auth.urls')),
|
||||||
# path('', TemplateView.as_view(template_name='home.html'), name='home'),
|
|
||||||
path('', views.get_basic_workdata, name='home'),
|
path('', views.get_basic_workdata, name='home'),
|
||||||
path('register/', accounts_views.register, name='register'),
|
path('register/', accounts_views.register, name='register'),
|
||||||
# url(r'^signup/$', accounts_views.signup, name='signup'),
|
|
||||||
|
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -59,7 +59,14 @@
|
|||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class = "container">
|
<div class = "container">
|
||||||
|
<div class="row">
|
||||||
|
{% if user.is_authenticated %}
|
||||||
|
Zalogowany: {{ user.username }}
|
||||||
|
<p><a href="{% url 'login' %}">Wyloguj</a></p> <br>
|
||||||
|
{% endif %}
|
||||||
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -68,9 +75,8 @@
|
|||||||
<footer><p class="mt-5 mb-3 text-muted">
|
<footer><p class="mt-5 mb-3 text-muted">
|
||||||
© Alicja Cięciwa</p></footer>
|
© Alicja Cięciwa</p></footer>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
|
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ho+j7jyWK8fNQe+A12Hb8AhRq26LrZ/JpcUGGOn+Y7RsweNrtN/tE3MoK7ZeZDyx" crossorigin="anonymous"></script>
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ho+j7jyWK8fNQe+A12Hb8AhRq26LrZ/JpcUGGOn+Y7RsweNrtN/tE3MoK7ZeZDyx" crossorigin="anonymous"></script>
|
||||||
</div>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -4,13 +4,6 @@
|
|||||||
{% load crispy_forms_tags %}
|
{% load crispy_forms_tags %}
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
|
||||||
{% if user.is_authenticated %}
|
|
||||||
Zalogowany: {{ user.username }}
|
|
||||||
<p><a href="{% url 'login' %}">Wyloguj</a></p> <br>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- form to input working hours-->
|
<!-- form to input working hours-->
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="form-hours">
|
<div class="form-hours">
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,42 +1,6 @@
|
|||||||
from django import forms
|
from django import forms
|
||||||
from work.models import HoursInput
|
from work.models import HoursInput
|
||||||
# from django.forms import extras
|
from datetime import datetime
|
||||||
from django.forms.widgets import SelectDateWidget
|
|
||||||
from datetime import datetime, date
|
|
||||||
from django.forms import ModelForm
|
|
||||||
# from work.models import HoursInput
|
|
||||||
|
|
||||||
WORKPLACE_CHOICE =(
|
|
||||||
("1", "oNE"),
|
|
||||||
("2", "TWO")
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
# base form to input the number of hours
|
|
||||||
# class HoursInputForm(forms.Form):
|
|
||||||
# date = forms.DateField(
|
|
||||||
# # input_formats=['%d.%m.%Y'],
|
|
||||||
# widget=forms.DateInput(attrs={
|
|
||||||
# 'class': 'form-control',
|
|
||||||
# 'type': 'date',
|
|
||||||
# # 'value': datetime.now().strftime("%d-%m-%Y")
|
|
||||||
# }),
|
|
||||||
# label="")
|
|
||||||
#
|
|
||||||
# hours_number = forms.IntegerField(
|
|
||||||
# label="",
|
|
||||||
# widget=forms.NumberInput(attrs={'required': True, 'type': 'number',
|
|
||||||
# 'placeholder': 'Liczba godzin', 'class': 'form-control'} ),
|
|
||||||
# min_value=0,
|
|
||||||
# max_value=15
|
|
||||||
# )
|
|
||||||
#
|
|
||||||
# workplace = forms.CharField(
|
|
||||||
# label="",
|
|
||||||
# widget=forms.TextInput(attrs={'autofocus': True, 'class': 'form-control',
|
|
||||||
# 'placeholder': 'Miejsce pracy'}),
|
|
||||||
# required=True
|
|
||||||
# )
|
|
||||||
|
|
||||||
|
|
||||||
class HoursInputForm(forms.ModelForm):
|
class HoursInputForm(forms.ModelForm):
|
||||||
@@ -48,13 +12,12 @@ class HoursInputForm(forms.ModelForm):
|
|||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(HoursInputForm, self).__init__(*args, **kwargs)
|
super(HoursInputForm, self).__init__(*args, **kwargs)
|
||||||
self.fields['date'] = forms.DateField(
|
self.fields['date'] = forms.DateField(
|
||||||
|
initial=datetime.now(),
|
||||||
widget=forms.DateInput(attrs={
|
widget=forms.DateInput(attrs={
|
||||||
'placeholder': 'Data',
|
'placeholder': 'Data',
|
||||||
'type': 'date',
|
'type': 'date',
|
||||||
}),
|
}),
|
||||||
error_messages={
|
)
|
||||||
'required': 'Podaj właściwą datę',
|
|
||||||
})
|
|
||||||
self.fields['hours_number'] = forms.IntegerField(
|
self.fields['hours_number'] = forms.IntegerField(
|
||||||
widget=forms.NumberInput(attrs={
|
widget=forms.NumberInput(attrs={
|
||||||
'placeholder': 'Liczba godzin'
|
'placeholder': 'Liczba godzin'
|
||||||
@@ -74,10 +37,3 @@ class HoursInputForm(forms.ModelForm):
|
|||||||
self.fields[field].help_text = None
|
self.fields[field].help_text = None
|
||||||
self.fields[field].label = ''
|
self.fields[field].label = ''
|
||||||
|
|
||||||
# class HoursInputForm(ModelForm):
|
|
||||||
# class Meta:
|
|
||||||
# model = HoursInput
|
|
||||||
# fields = ['date', 'hours_number']
|
|
||||||
# date = forms.DateField()
|
|
||||||
# hours_number = forms.IntegerField(min_value=0, max_value=15, required=True)
|
|
||||||
# workplace = forms.ChoiceField(choices=WORKPLACE_CHOICE)
|
|
||||||
|
|||||||
@@ -2,12 +2,6 @@ from django.db import models
|
|||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
|
|
||||||
# TITLE_CHOICES = [
|
|
||||||
# ('MR', 'Mr.'),
|
|
||||||
# ('MRS', 'Mrs.'),
|
|
||||||
# ('MS', 'Ms.'),
|
|
||||||
# ]
|
|
||||||
#
|
|
||||||
class HoursInput(models.Model):
|
class HoursInput(models.Model):
|
||||||
date = models.DateField(default=datetime.date.today)
|
date = models.DateField(default=datetime.date.today)
|
||||||
hours_number = models.IntegerField()
|
hours_number = models.IntegerField()
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
from django.http import HttpResponseRedirect
|
from django.http import HttpResponseRedirect
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from work.models import HoursInput
|
|
||||||
from work.forms import HoursInputForm
|
from work.forms import HoursInputForm
|
||||||
import psycopg2
|
|
||||||
|
|
||||||
|
|
||||||
def get_basic_workdata(request):
|
def get_basic_workdata(request):
|
||||||
@@ -11,12 +9,6 @@ def get_basic_workdata(request):
|
|||||||
form = HoursInputForm(request.POST)
|
form = HoursInputForm(request.POST)
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
form.save()
|
form.save()
|
||||||
# form.date = request.POST.get('date')
|
|
||||||
# form.hours_number = request.POST.get('hours_number')
|
|
||||||
# form.workplace = request.POST.get('workplace')
|
|
||||||
# date = form.cleaned_data['date']
|
|
||||||
# hours_number = form.cleaned_data['hours_number']
|
|
||||||
# workplace = form.cleaned_data['workplace']
|
|
||||||
return HttpResponseRedirect('/')
|
return HttpResponseRedirect('/')
|
||||||
else:
|
else:
|
||||||
form = HoursInputForm()
|
form = HoursInputForm()
|
||||||
|
|||||||
Reference in New Issue
Block a user