diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 06e9d10..26f8b26 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -2,14 +2,12 @@ - - - + + + - - diff --git a/config/__pycache__/urls.cpython-38.pyc b/config/__pycache__/urls.cpython-38.pyc index 73d0fb9..d7efedc 100644 Binary files a/config/__pycache__/urls.cpython-38.pyc and b/config/__pycache__/urls.cpython-38.pyc differ diff --git a/config/urls.py b/config/urls.py index 12401c3..99bb6b3 100644 --- a/config/urls.py +++ b/config/urls.py @@ -28,5 +28,6 @@ urlpatterns = [ path('accounts/sign_up/', accounts_views.sign_up, name='sign-up'), path('accounts/login/', views.LoginView.as_view(), name='login'), 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'), ] diff --git a/static/css/main.css b/static/css/main.css index 0e28d59..dbac288 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -148,7 +148,16 @@ a.btn-logout { -webkit-appearance: button; -moz-appearance: button; appearance: button; - text-decoration: none; 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; } \ No newline at end of file diff --git a/templates/addworkplace.html b/templates/addworkplace.html index 98b0f0f..8452ac6 100644 --- a/templates/addworkplace.html +++ b/templates/addworkplace.html @@ -3,9 +3,7 @@ {% block content %} {% load crispy_forms_tags %} - - - +
{% csrf_token %} @@ -13,6 +11,4 @@
- - {% endblock %} \ No newline at end of file diff --git a/templates/base.html b/templates/base.html index 097476b..e2883d6 100644 --- a/templates/base.html +++ b/templates/base.html @@ -52,7 +52,7 @@ Dodaj pracownika {% endif %} diff --git a/templates/workplaces.html b/templates/workplaces.html new file mode 100644 index 0000000..e2923a9 --- /dev/null +++ b/templates/workplaces.html @@ -0,0 +1,26 @@ +{% extends "base.html" %} + +{% block content %} +{% load crispy_forms_tags %} + + +
+ + Dodaj pracę

+ + + + + + + + + {% for wp in workplaces.all %} + + + + {% endfor %} + +
Miejsca pracy
{{ wp.workplace }}
+ +
+{% endblock %} \ No newline at end of file diff --git a/work/__pycache__/views.cpython-38.pyc b/work/__pycache__/views.cpython-38.pyc index 3ce8617..7967255 100644 Binary files a/work/__pycache__/views.cpython-38.pyc and b/work/__pycache__/views.cpython-38.pyc differ diff --git a/work/views.py b/work/views.py index f4d17f0..f60bcc4 100644 --- a/work/views.py +++ b/work/views.py @@ -27,8 +27,15 @@ def addworkplace_view(request): form = WorkplaceInputForm(request.POST) if form.is_valid(): form.save() - return HttpResponseRedirect('/') + return HttpResponseRedirect('/work/workplaces/') else: form = WorkplaceInputForm() 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}) \ No newline at end of file