From 119a6b3425a1586348109f4b37a59174e5dee470 Mon Sep 17 00:00:00 2001 From: "holger.trampe" Date: Fri, 24 Apr 2020 02:20:24 +0200 Subject: [PATCH] Dynamischer Steckbrief fertig --- .../templates/dasettings/agency_content.html | 2 +- .../__pycache__/settings.cpython-38.pyc | Bin 3946 -> 3946 bytes digitaleagentur/settings.py | 26 +++---- orga/__pycache__/views.cpython-38.pyc | Bin 2440 -> 2334 bytes orga/templates/orga/orga_single.html | 70 +++++++++++------- orga/views.py | 37 +++++---- .../__pycache__/counter_tag.cpython-38.pyc | Bin 5494 -> 6315 bytes standards/templatetags/counter_tag.py | 44 +++++++++++ users/usersforms.py | 3 +- 9 files changed, 120 insertions(+), 62 deletions(-) diff --git a/dasettings/templates/dasettings/agency_content.html b/dasettings/templates/dasettings/agency_content.html index 9784143..584dccc 100644 --- a/dasettings/templates/dasettings/agency_content.html +++ b/dasettings/templates/dasettings/agency_content.html @@ -15,7 +15,7 @@
{% for formfield in agencyform %} - {% if forloop.counter|divisibleby:5 %} + {% if forloop.counter|divisibleby:6 %}
{{formfield|as_crispy_field}} diff --git a/digitaleagentur/__pycache__/settings.cpython-38.pyc b/digitaleagentur/__pycache__/settings.cpython-38.pyc index e12786e331ce94eef622ceb547f19b234d83f691..39f9bc6946edb76318c5941435fb4c89d2cc10cd 100644 GIT binary patch delta 485 zcmXv}OHUJF6rFD#JZfjks}w}bQ{*{QEIueI0fk+?;cAl6x7wjOrO(4@hEu$9`n9=X!Qdqad0{7cc}u zXhr}J#0H_msA?{w7KEr3E!2iqYDXK|(Sfj|QU^K_Isa*XbGj)E3o%UL8RD46bG&ex zs1q+Kf>(|N4Kqk!7O(NfQC)_&Rn=kCg*oa*67xbyV!`J{pO;)F`X6GMdXS<=SfR(z zC@Rp4RqDeU^<$j|ut9@(NBcuIJCZLHpP$%Tjnx=7BN7e!%2Rt7?`txRV2eiYlm>hd z${0S!Hces&x6hhLBZFO+iQ9s_BaMEl|6)lN8a(8@P)b-9?90QgyiFCy% zo$!KL;>8@#o3PytS&}LPrE;N=FY@I7C|t+oxnp}W=h$C)xo95bPrQmU6bs)wcgDV- zr!F2(pYoOYtuLw7z0X)b&TOugXUg$R{jXv*vQ+(FpsFy%`)>3%>#CwQsB%#C{uq{b HWt`mr_Ed{P delta 484 zcmXw!O-~bH6ou!V51iJ{w0ss6D%FaDG9wl(1(jMpE2wCxn!6yWoXK(Xr#*Y5lm{s0o!Zhh0hy}9S!JUKbZJxiUXjEZ4IB~gF0?|ZpZV{b{P7$RgK zN~YLxTt*CrXcKWH+M35Gfqv@801aS}1~G(Tj3DW%G<5pI`T`sG+%X!)9PT5Fc|5>F zj3-!jRga<2R$WG;cuHd^VnvW5R(rbE({+!D{43a?tJtJ* zlxPAvrNmr=Mw56(X>8GTY}5V?Jg1DqKFHscp5An{4(l+yNJ=!-Be$F>yzIzy8#^?8 zPWtdlkQuzDJ0kEd$~22z=;B!m6}-V)kBQrcT$ZNab$_w~i%irwZ~BY29cs$_#(H4- zb>6gm-m3D31;^WxC22Pp_m7*+MvE8VxgM_`II~sPIpoJJYrjzs64jlPd_9}aon-5U zg+`i(zLJ@VUwF^0G`g9u1@D7T#Uox>Ii!Qq$L+bJax18He=GK-?!RbTVQTo*Oh-&r RQTtRmriQ;vJN#>Y{tqURit+#e diff --git a/digitaleagentur/settings.py b/digitaleagentur/settings.py index 99f1eff..6d7e5be 100644 --- a/digitaleagentur/settings.py +++ b/digitaleagentur/settings.py @@ -14,33 +14,31 @@ 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__))) - -############################################## PROD ##################################### -BASE_URL = "https://digitale-agentur.com/" +############################################## DEV ##################################### +BASE_URL = "https://dev01.digitale-agentur.com/" CRONAPIKEY = "gCddsaz6NOnE9QbXZM5LasdEk122D" # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = False +DEBUG = True -# MAIL PROD +# MAIL DEV EMAIL_HOST = 'smtp.strato.de' EMAIL_PORT = 587 EMAIL_USE_TLS = True -EMAIL_HOST_USER = "support@digitale-agentur.com" -EMAIL_HOST_PASSWORD = "aPx9m3!7x3m@8o!t" -DEFAULT_FROM_EMAIL = "support@digitale-agentur.com" +EMAIL_HOST_USER = "support@dev01.digitale-agentur.com" +EMAIL_HOST_PASSWORD = "support@dev01.digitale-agentur.com" +DEFAULT_FROM_EMAIL = "support@dev01.digitale-agentur.com" -# PROD +# DEV DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', - 'NAME' : 'digitaleagentur', - 'USER' : 'digitaleagentur', - 'PASSWORD' : 'H9hzbzyBqtUCnZlIwL1qSrzh', + 'NAME' : 'digitaleagentur_dev01', + 'USER' : 'digitaleagentur_dev01', + 'PASSWORD' : 't3TvtGAOkFHYXdJlUMIu9u3U', 'PORT' : 3306 } } - -############################################## PROD ##################################### +############################################## DEV ##################################### # Nach zehn Stunden läuft der Cookie ab! diff --git a/orga/__pycache__/views.cpython-38.pyc b/orga/__pycache__/views.cpython-38.pyc index c67ae01986d386f52ad84412316a32a7082c51a7..63635470a10de0b7aa3152a2651c5a0cfa3490e1 100644 GIT binary patch delta 754 zcmYL_&2G~`5XX1c_S#NuCr#2MP1__0REUab4ycv5AVj%Vl_EZ+fC|Lamo`QArQO)v!>7;?QdpwX8vC9o5I_?f7|yn1lPCKcMrdQ z@Gnzns%!Km`068Fhn)INi!iI0aSm$glCfWJVDApq6Q?VOKEQnw_vn@SY_#CH`e|G} zNW2(gN08Wv&De@rXdc3`8?qCSR+mU7j197#leS>TzOduq1c2-w3T^2M6YFa-BTV7WlQ{d=KguPUWcE1!@AL#F2XI=-3O97tiFEfq2^tsV46-Oa zB$NKQn#|!fDQ0F|!b`e`5SL|emke@1w1pWN+$RHikAyR*I3qma3j_NrB1os^Q&v+h z2$uTA&|5k3Wj0w7*$MtvQWGTfF*e#HsfWP?+9V`x(#&o)DK9H&U2jdzLFZ}20pF2( zh$iqdx^b|%yYnPz>_@yCJ&p!kKX%jSS@qrOF)QhedLuPvYg-L&>d^vXYILK7&*`+J z;cI9y&NPY|6^*=xrC}qctTP-&gK%nURrQ12qI_B1u`fVNy|AmT9AD6_sZc7uqSK3d z(&_a3=~eiuPGLBuokYF2mv8VT-BkOJx~^wNyMt~&dd9n*Cg!6p1feCb0!3)RA~V5( ufI3Kzs+v z(eCU7W^4%kAz7S`O`!{8m_*L$`o`rp_YV9swF|q@t2n|4GBYGLHX=czT%1AXV+(1< z+3hkfL=aKT^r$~F18WbWVr)Mn?HmwgK{mEukT!iz_|5>fT7pCxHXDJx2XSAM#16WP z?ukCU+RNBi9m0iC30#b|1;Q@}-YzVVfGm)@ zKVPS;B%c`fCK=#2XAYtctc1(9H{V)X=GCo`HN&@Io4KmNR}DVP$zR4w&12y@3p-(( zH+X9+Osw!jxU|XFSdwjQ^5r$w;veONIX!!Y>1uNkk!a13vq6;(DR>HM9y1jN6owW0 z6%2$tG#}Lxz1?^pvaAv(5sB7VT}{l!`g+(7*p!lQ$-ia|Zp+b3xtwPsN=na7XHBT| z8bUTRS05*|!_#AWJ5f)d!^Tuo
-

Bereiche und Aufgaben von {{user_first_name}} {{user_last_name}} +

Bereiche und Tätigkeiten von {{user_first_name}} {{user_last_name}} {% if user|usergperm:"usermanager" %} - {% if request.user.profile.agency.dynamicprofile == False %} + {% if request.user.profile.agency.dynamicprofile %}


+

{{ user_first_name }} {{ user_last_name }} + + {% if request.user.profile.agency.dynamicprofile %} + + als Verantwortlicher + + + {% endif %} +

@@ -78,35 +87,32 @@ {% for area in areas %} - {% else %} + + {% endfor %} + {% else %} {% for prio in prios %} {% if prio.task.area.pk == area.pk and prio.task.visible %} @@ -197,19 +203,29 @@ $( document ).ready(function() { $( "#sortarea_" + sortablearea_ids[i]).sortable("disable"); } + + //AUTH $(document).find(".view_0").hide(); + //EX $(document).find(".view_1").hide(); + //REP $(document).find(".view_2").hide(); - $(document).find(".view_2").show(); + $(document).find(".view_0").show(); + }); function changeView(newview){ + $(document).find(".view_0").hide(); $(document).find(".view_1").hide(); $(document).find(".view_2").hide(); $(document).find(".view_" + newview).show(); - + + $(document).find("#view_info_0").hide(); + $(document).find("#view_info_1").hide(); + $(document).find("#view_info_2").hide(); + $(document).find("#view_info_" + newview).show(); } diff --git a/orga/views.py b/orga/views.py index 538a617..39f613c 100644 --- a/orga/views.py +++ b/orga/views.py @@ -55,6 +55,20 @@ def singleorga(request, pk): if(user.profile.agency.pk==request.user.profile.agency.pk): prios = Prio.objects.filter(user__pk=pk).order_by('prio') areas = list(Areas.objects.filter(agency__pk=request.user.profile.agency.pk).order_by('areaorder')) + alltasks = Tasks.objects.filter(agency__pk=request.user.profile.agency.pk).order_by('name') + + ''' + Hier werden die Tasks entsprechend ihrer Prio gespeichert, anschließend werden noch die übrigen Tasks übertragen, die noch keinen Prio-Eintrag haben. Diese haben 0 und landen dementsprechend hinten. + ''' + + tasks = [] + for p in prios: + tasks.append(p.task) + + for at in alltasks: + if at not in tasks: + tasks.append(at) + i = 0 for area in areas: areas[i].hex = areas[i].color @@ -69,22 +83,6 @@ def singleorga(request, pk): except: userfuncname = "Nicht vergeben" - st = Standards.objects.filter(agency=request.user.profile.agency) - - representative = [] - executor = [] - authority = [] - - for s in st: - if request.user in s.representative.all(): - representative.append(s) - - if request.user in s.executor.all(): - executor.append(s) - - if request.user in s.authority.all(): - authority.append(s) - context = { 'active_link' : 'orga', @@ -98,9 +96,10 @@ def singleorga(request, pk): 'imageurl' : user.profile.get_photo_url, 'compfunc' : user.profile.compfunc, 'phoneland' : user.profile.phoneland, - 'representative' : representative, - 'executor' : executor, - 'authority' : authority, + 'tasks' : tasks, + #'representative' : representative, + #'executor' : executor, + #'authority' : authority, 'phonemobile' : user.profile.phonemobile } print(context) diff --git a/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc b/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc index c786c9be1801944dcb67d67a232862121cf8b2f1..59ca8c15e61299e01184846e6113331401ecd1fa 100644 GIT binary patch delta 895 zcmcJMPixdb7{+HNlWaD-8!T?M2U)ZSVWkIa4}#V|)$XE~Dzytz&=NXRn`}+8Z)VF{ zvgA;&qOxB=JqX2<^xFhKfghmg&3CdcNUeD4!22XK&pR{xo;kYmW!~-7Y7W8i;l5WmDkY0Oj&soYkYY#5AA9Yrin>LiO0~%W9bZ;q! zXv^P`L;BpQ-I{xRjhhA?zIE%%(2o)TR~#g=?prPc{h%x_B8zVz-|DBM%6%W1NL8 z2XeEoA}FGOSQ|Yp$3UG4Xlw8t?Gq?7#N0*elrfJ}mRDPk3(V~AcmIRa1sQ`(WT-sl z@5=wsRwlHoGX8loF47LrX)ffJ2)yt`bolw~BCY6$E@FVe=&dm`I;y*LZ)8sQs!oMd Jr-tQn`U_|_x?TVP delta 63 zcmZ2&_)Uv1l$V!_0SM|}&x|`MGLcV)=?>#Yom-4-DQv+EnpT_5m?j7^X&P+aA?Ct3 SS(Qa(vb+QzW8P#vi9!HDjuA)z diff --git a/standards/templatetags/counter_tag.py b/standards/templatetags/counter_tag.py index 08f0103..a341a8d 100644 --- a/standards/templatetags/counter_tag.py +++ b/standards/templatetags/counter_tag.py @@ -215,3 +215,47 @@ def getifuserdidcomment(standard, user): didcomment = True return didcomment + + +@register.simple_tag +def isUserInAuth(task, area, user): + st_auth = Standards.objects.filter(agency=user.profile.agency, task=task, area=area) + + found = False + + for st in st_auth: + if user in st.authority.all(): + found = True + print("AUTH FOUND") + break + + return found + +@register.simple_tag +def isUserInEx(task, area, user): + st_auth = Standards.objects.filter(agency=user.profile.agency, task=task, area=area) + + found = False + + for st in st_auth: + if user in st.executor.all(): + found = True + print("EX FOUND") + break + + return found + + +@register.simple_tag +def isUserInRep(task, area, user): + st_auth = Standards.objects.filter(agency=user.profile.agency, task=task, area=area) + + found = False + + for st in st_auth: + if user in st.representative.all(): + found = True + print("REP FOUND") + break + + return found \ No newline at end of file diff --git a/users/usersforms.py b/users/usersforms.py index 26f7f4b..e7c8fd1 100644 --- a/users/usersforms.py +++ b/users/usersforms.py @@ -78,9 +78,10 @@ class AgencyUpdateForm(forms.ModelForm): "city" : "Stadt", "agency_email" : "E-Mail", "phone" : "Telefon", + "dynamicprofile" : "Dynamischer Steckbrief", "agencypic" : "Agenturbild" } - fields = ['name','inhaber','agency_email', 'phone', 'street', 'plz', 'city', 'agencypic', 'x', 'y', 'width', 'height', 'rotation'] + fields = ['name','inhaber','agency_email', 'phone', 'street', 'plz', 'city', 'dynamicprofile', 'agencypic', 'x', 'y', 'width', 'height', 'rotation'] def save(self): photo = super(AgencyUpdateForm, self).save()
- {% if request.user.profile.agency.dynamicprofile == False %} + {% if request.user.profile.agency.dynamicprofile %} - {% for ex in executor %} - {% if ex.area == area %} - + {% for task in tasks %} + {% isUserInAuth task area request.user as checkIsUserAuth %} + {% if task.area.pk == area.pk and task.visible and checkIsUserAuth %} + {% endif %} - {% endfor %} - {% for auth in authority %} - {% if auth.area == area %} - + {% isUserInEx task area request.user as checkIsUserEx %} + {% if task.area.pk == area.pk and task.visible and checkIsUserEx %} + {% endif %} - {% endfor %} - {% for rep in representative %} - {% if rep.area == area %} - - + {% isUserInRep task area request.user as checkIsUserRep %} + {% if task.area.pk == area.pk and task.visible and checkIsUserRep %} + {% endif %} - {% endfor %} -
-