From b8c345a3b851b2711b451b1bbab57941e82f893c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alicja=20Ci=C4=99ciwa?= Date: Mon, 28 Dec 2020 23:07:31 +0100 Subject: [PATCH] table view --- .idea/workspace.xml | 9 ++++----- config/__pycache__/urls.cpython-38.pyc | Bin 1405 -> 1464 bytes config/urls.py | 3 ++- static/css/main.css | 11 ++++++++++- templates/addworkplace.html | 6 +----- templates/base.html | 2 +- templates/workplaces.html | 26 +++++++++++++++++++++++++ work/__pycache__/views.cpython-38.pyc | Bin 1004 -> 1242 bytes work/views.py | 9 ++++++++- 9 files changed, 52 insertions(+), 14 deletions(-) create mode 100644 templates/workplaces.html 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 73d0fb959c6f3319bb243bf2fa1634af65f51a18..d7efedc5a1df1eaf43392f19de7fe0298e3c7c3b 100644 GIT binary patch delta 160 zcmey%wS!wbl$V!_0SF|$Ud7k2GB7*_agYHIkmCTv#d{`duarn-NfA!v$P!5rN#W{c zPUnacO%V-d&=lKvPlK6Ns64+Ydon+ZjAE4lh^Y@E3UU&YQ;YSZxDXsaO|i*(EH?zB b_=_|0%i|Feli64!8D%CXu*xtq^8Ek+OA#r~ delta 100 zcmdnN{g+ESl$V!_0SG<_zKS--> - - +
{% 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 3ce86178c36e6ca0672c2e68f2b9b0aefae3af39..796725511321736e301c33643ee1c0aa87d068bc 100644 GIT binary patch delta 336 zcmaFEev6YYl$V!_0SK-Kzly)aGLcV)F=V2)yHF}y3TFye3qvzw6lV%|FoPz~#tJPa z`CF_3MTyC&MQlJFRf78E`9;}aq96w-TC6{LGtmK;`4(R|OqFL|L21b?_Wa%qQvCXA~v9^ vA`T!i`7F~+c2OY1Pm^=91xo^>=;V1UYC?QK5gtY!Mh-?EW+p~1ekMi$aP1QH 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