table view
This commit is contained in:
9
.idea/workspace.xml
generated
9
.idea/workspace.xml
generated
@@ -2,14 +2,12 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<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 afterPath="$PROJECT_DIR$/templates/addworkplace.html" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/templates/workplaces.html" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/work/migrations/0003_auto_20201228_1744.py" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/work/migrations/0004_workplaceinput.py" afterDir="false" />
|
|
||||||
<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$/config/urls.py" beforeDir="false" afterPath="$PROJECT_DIR$/config/urls.py" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/static/css/main.css" beforeDir="false" afterPath="$PROJECT_DIR$/static/css/main.css" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/templates/addworkplace.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/addworkplace.html" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/templates/base.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/base.html" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/templates/base.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/base.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/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" />
|
||||||
@@ -20,6 +18,7 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="Git.Settings">
|
<component name="Git.Settings">
|
||||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
||||||
|
<option name="UPDATE_TYPE" value="MERGE" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectId" id="1j71bSwhqpUMSNPYaQQ9lvdeSR6" />
|
<component name="ProjectId" id="1j71bSwhqpUMSNPYaQQ9lvdeSR6" />
|
||||||
<component name="ProjectLevelVcsManager" settingsEditedManually="true">
|
<component name="ProjectLevelVcsManager" settingsEditedManually="true">
|
||||||
|
|||||||
Binary file not shown.
@@ -28,5 +28,6 @@ urlpatterns = [
|
|||||||
path('accounts/sign_up/', accounts_views.sign_up, name='sign-up'),
|
path('accounts/sign_up/', accounts_views.sign_up, name='sign-up'),
|
||||||
path('accounts/login/', views.LoginView.as_view(), name='login'),
|
path('accounts/login/', views.LoginView.as_view(), name='login'),
|
||||||
path('accounts/logout/', accounts_views.logout_view, name='logout'),
|
path('accounts/logout/', accounts_views.logout_view, name='logout'),
|
||||||
path('accounts/addworkplace/', work_views.addworkplace_view, name='addworkplace'),
|
path('work/addworkplace/', work_views.addworkplace_view, name='addworkplace'),
|
||||||
|
path('work/workplaces/', work_views.show_workplaces, name='workplaces'),
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -148,7 +148,16 @@ a.btn-logout {
|
|||||||
-webkit-appearance: button;
|
-webkit-appearance: button;
|
||||||
-moz-appearance: button;
|
-moz-appearance: button;
|
||||||
appearance: button;
|
appearance: button;
|
||||||
|
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: #EDEDED;
|
color: #EDEDED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.table-view {
|
||||||
|
width: 100%;
|
||||||
|
max-width: 420px;
|
||||||
|
padding: 20px;
|
||||||
|
margin: auto;
|
||||||
|
background-color: rgba(255,255,255,0.7);
|
||||||
|
margin-top: 150px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
@@ -3,9 +3,7 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
{% load crispy_forms_tags %}
|
{% load crispy_forms_tags %}
|
||||||
|
|
||||||
<!--<div class="container">-->
|
<!-- form to input workplace -->
|
||||||
<!-- form to input working hours-->
|
|
||||||
<!-- <div class="row">-->
|
|
||||||
<div class="form-hours">
|
<div class="form-hours">
|
||||||
<form method="post">
|
<form method="post">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
@@ -13,6 +11,4 @@
|
|||||||
<button class="btn btn-lg btn-success btn-block" type="submit">Dodaj</button>
|
<button class="btn btn-lg btn-success btn-block" type="submit">Dodaj</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<!-- </div>-->
|
|
||||||
<!--</div>-->
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -52,7 +52,7 @@
|
|||||||
<a class="nav-link" href="{% url 'sign-up' %}">Dodaj pracownika</a>
|
<a class="nav-link" href="{% url 'sign-up' %}">Dodaj pracownika</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="{% url 'addworkplace' %}">Dodaj pracę</a>
|
<a class="nav-link" href="{% url 'workplaces' %}">Prace</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
26
templates/workplaces.html
Normal file
26
templates/workplaces.html
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
{% load crispy_forms_tags %}
|
||||||
|
|
||||||
|
<!-- Show workplaces -->
|
||||||
|
<div class="table-view">
|
||||||
|
<a href="{% url 'addworkplace' %}">+ Dodaj pracę</a> <br><br>
|
||||||
|
|
||||||
|
<table class="table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th scope="col">Miejsca pracy</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for wp in workplaces.all %}
|
||||||
|
<tr>
|
||||||
|
<td>{{ wp.workplace }} <br></td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
Binary file not shown.
@@ -27,8 +27,15 @@ def addworkplace_view(request):
|
|||||||
form = WorkplaceInputForm(request.POST)
|
form = WorkplaceInputForm(request.POST)
|
||||||
if form.is_valid():
|
if form.is_valid():
|
||||||
form.save()
|
form.save()
|
||||||
return HttpResponseRedirect('/')
|
return HttpResponseRedirect('/work/workplaces/')
|
||||||
else:
|
else:
|
||||||
form = WorkplaceInputForm()
|
form = WorkplaceInputForm()
|
||||||
|
|
||||||
return render(request, 'addworkplace.html', {'form': form, 'title': title})
|
return render(request, 'addworkplace.html', {'form': form, 'title': title})
|
||||||
|
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
def show_workplaces(request):
|
||||||
|
title = "Prace"
|
||||||
|
workplaces = WorkplaceInput.objects
|
||||||
|
return render(request, 'workplaces.html', {'workplaces': workplaces, 'title': title})
|
||||||
Reference in New Issue
Block a user