From f9e4720b58f11b87c0eaf77e610d295fb0bba3c5 Mon Sep 17 00:00:00 2001 From: Holger Trampe Date: Mon, 16 Dec 2019 18:24:45 +0100 Subject: [PATCH] =?UTF-8?q?Standardanischt=20gleich=20Link=20Standard=20zu?= =?UTF-8?q?m=20Aufgabenbereich=20Z=C3=A4hler=20mit=20customtag=20bei=20Sta?= =?UTF-8?q?ndards?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- standards/__pycache__/forms.cpython-38.pyc | Bin 3060 -> 3005 bytes standards/__pycache__/views.cpython-38.pyc | Bin 6189 -> 6189 bytes standards/forms.py | 7 ++- .../standards/standards_management.html | 29 ++++++----- standards/templatetags/__init__.py | 0 .../__pycache__/__init__.cpython-38.pyc | Bin 0 -> 171 bytes .../__pycache__/counter_tag.cpython-38.pyc | Bin 0 -> 626 bytes standards/templatetags/counter_tag.py | 45 ++++++++++++++++++ users/__pycache__/urls.cpython-38.pyc | Bin 1857 -> 1857 bytes users/__pycache__/views.cpython-38.pyc | Bin 14950 -> 14925 bytes users/templates/users/searchres.html | 8 ++-- users/urls.py | 2 - users/views.py | 5 +- 13 files changed, 72 insertions(+), 24 deletions(-) create mode 100644 standards/templatetags/__init__.py create mode 100644 standards/templatetags/__pycache__/__init__.cpython-38.pyc create mode 100644 standards/templatetags/__pycache__/counter_tag.cpython-38.pyc create mode 100644 standards/templatetags/counter_tag.py diff --git a/standards/__pycache__/forms.cpython-38.pyc b/standards/__pycache__/forms.cpython-38.pyc index 3aa40282bca13a54e6c0a0efebd49624d213f26c..c9429960e4b0e396dd3523e4e9220c272d0a0a34 100644 GIT binary patch delta 937 zcma)5OKTHR7@a$rOlBrClUHMsHpQwHJ1W!{#g>qOh|&k?LUbX>WSTpOZEVY(cHycE zUAPU`wfllg#g#k#16>AO`VTDPO23l~8HIpOxQFka?>Xn2e6M_}I1e4iQt0{i{>PK~ zzB9{S_ph|t_Z6Pu#w&#zA=^&9Og*-UF}X#I6*F04vfL)djv1R6hr7hMG2`&u1I5et zKeuGTD$95JlI*aPyi5H=4v+^F40l+(Oe81ZZ zqNp48dcH44gTQ+WFsx#bm8BDD1cvICsAnhr@u+|Zo1iUHA3JYFEXw;FdEPI_+c+> TGKz@skFZ(%(~I-PZ1K`>(iNhF delta 1032 zcma)*-)qxQ6vuPZENz;m&CDvJ1|_uGX=p`b1KaPIeQHQR2eLhed{0jMKW<)8>1f~It&&#*f0?Y#U z$nDV!`JjOKsB~~MOUQzClB7dqZW=6>l zBja&_B7dvY@6TX)2$%)t0C)q#aoSzi_uF2#>p1M75O^;Dqb!=R65{a{7;-u*&it$` z^WCYzj)f>gpvkf@qy148IPA1|e2gJM6j_$!UrKCLL~~DJlWLokrzW;nkw-=zg^4x) zs?GA3>N|cbUM?{d^N%`eVRzref9@1TI6DHM&tha@i?`MfMspOdu-VzR=zia$j^B4T zsmrLdGGNCLumqr$Oa7Od)*s-C=1U

Standards

@@ -30,22 +32,25 @@
{% for area in areas %}
-
Standards aus dem Bereich {{area.name}}
-
+
Standards aus dem Bereich {{area.name}}
+
+ {% for task in tasks %} - {% for task in tasks %} - {% if task.area == area %} -
+ {% if task.area == area %} +
-
{{task.name}}
- {% for standard in standards_of_agency %} - {% if standard.task == task and standard.area == area %} -

{{standard.name}}

- {% endif %} - {% endfor %} +
{{task.name}}
+ {% setvar 0 %} + {% for standard in standards_of_agency %} + {% getvar as varcounter %} + {% if standard.task == task and standard.area == area and varcounter < 3 %} + {% incvar %} +

{{standard.name}}

+ {% endif %} + {% endfor %}
- {% endif %} + {% endif %} {% endfor %}
diff --git a/standards/templatetags/__init__.py b/standards/templatetags/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/standards/templatetags/__pycache__/__init__.cpython-38.pyc b/standards/templatetags/__pycache__/__init__.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..af17d420883d685b0d74e9fcfa760150961d27a2 GIT binary patch literal 171 zcmWIL<>g`kg1jByV?p#|5P=LBfgA@QE@lA|DGb33nv8xc8Hzx{2;x_OvsFxJacWU< zOlV$FYGO`|OMY@`Zfaghag4iXNK8s*dS*#tPHJL0P^h#hrnn?AFD0=kr8uS}HMbxq nu_U!5F}*k@K0Y%qvm`!Vub}c4hfQvNN@-529muB7K+FIDOLHxo literal 0 HcmV?d00001 diff --git a/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc b/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc new file mode 100644 index 0000000000000000000000000000000000000000..1ea8fa6d11df15016a7572576aa8620c272ae800 GIT binary patch literal 626 zcmZ`$%}N6?5Ki{LrM>tTy?7NwM5ri&?4|ayL?qpWWy}7QNw!e%rVpaWzJpJ);K@^; zK=9;Ds8SFIW_G@8@_q9&ACHF&?fvcZKJys+AaH0tf(vwWg+VdJD^~N2bEf%=_sTL~ zF&Suo87fct&+Lh3kwbwB9f}=_RP0cqk{O!}cF4shyicsISCzCn=XA0+%E_nbCc*H? zBnsn0FYVcu_k4kG!?mnBy=4&Njj!4CRLqSABjycgS&7Rw?`qvxBd%}mger^D%1X-u zk2(;>%0@|0M*LJ@Wno0#c8%5WfZ%ww=_8}v}pbGN?4g>t=1P<-DT)Ji%mdaD0 z+&w-B)J`82j(3c?!I>j3&=UTz(mywZ5hfN#a6*IdkljyrBndu+|8>eH$NG=((!TzL z197F3K_985Y>F00q>pdQ1xVQR3Fx9UI0Fdjd}vBskfwpS#$BC`;-Dv50Jz4Iv$|DX WrO&B2L%Jg`@d7X4!w@|{kG=t_OnL?Y literal 0 HcmV?d00001 diff --git a/standards/templatetags/counter_tag.py b/standards/templatetags/counter_tag.py new file mode 100644 index 0000000..35c2da8 --- /dev/null +++ b/standards/templatetags/counter_tag.py @@ -0,0 +1,45 @@ +from django import template + +register = template.Library() + +b = 0 + +@register.simple_tag +def setvar(value): + global b + b = value + return '' + +@register.simple_tag +def getvar(): + global b + return b + +@register.simple_tag +def incvar(): + global b + b += 1 + return '' + + +''' +class Counter: + count = 0 + @register.simple_tag + def increment(self): + self.count += 1 + return '' + + @register.simple_tag + def decrement(self): + self.count -= 1 + return '' + + @register.simple_tag + def double(self): + self.count *= 2 + return '' + + def getCounter(self): + return count +''' \ No newline at end of file diff --git a/users/__pycache__/urls.cpython-38.pyc b/users/__pycache__/urls.cpython-38.pyc index 26e173d345e0b927e76f2454e0196328df6d6636..24631cb5a9406143b92574e52d7fd3b73b27c7b2 100644 GIT binary patch delta 22 ccmX@ecaV=al$V!_0SKa<+swl$V!_0SFFn`W}0BBd?ea zqZ%F;hS~VKn!GV4Ijk(35` zPZ4Tn3}z^iu3>6stYro1VXGAcX_>66C&?%?*Y5Z$?4?iQ21Tw=@_V+0{W2$zp0q_D8iQm_!qG_okH5R7g)hsd=Cf?G=9 zqK&QGf3VX3U=^?x!PdQt;55T~%zN`@-sM8F6UJ7Eu8-%R;r9!x_%KrqziklXzFJo2 zeji@d%)e}+9Rd*PAWeHgfN;?erpOA5=Oz&3WHI5?PJ4UTMJ7toDjIXG8Rb({ULs`C z+MECxe_{TB3`c>3jj?b> diff --git a/users/templates/users/searchres.html b/users/templates/users/searchres.html index 563aebc..1238a92 100644 --- a/users/templates/users/searchres.html +++ b/users/templates/users/searchres.html @@ -4,7 +4,7 @@

Standards

{% if res_standard|length > 0 %} {% for s in res_standard %} - {{s.name|striptags}} | {{s.content|truncatechars:125|striptags}}

+   {{s.name|striptags}} | {{s.content|truncatechars:125|striptags}}

{% endfor %} {% else %}

Keine Ergebnisse in Standards

@@ -14,7 +14,7 @@

Bereiche

{% if res_areas|length > 0 %} {% for s in res_areas %} - {{s.name|striptags}}

+   {{s.name|striptags}}

{% endfor %} {% else %}

Keine Ergebnisse in Bereichen

@@ -24,7 +24,7 @@

Aufgaben

{% if res_tasks|length > 0 %} {% for s in res_tasks %} - {{s.name|striptags}}

+   {{s.name|striptags}}

{% endfor %} {% else %}

Keine Ergebnisse in Aufgaben

@@ -34,7 +34,7 @@

Personen

{% if res_pers|length > 0 %} {% for s in res_pers %} - {{s.first_name}} {{s.last_name}}

+   {{s.first_name}} {{s.last_name}}

{% endfor %} {% else %}

Keine Ergebnisse in Personen

diff --git a/users/urls.py b/users/urls.py index 71e3c7c..2c89fc8 100644 --- a/users/urls.py +++ b/users/urls.py @@ -33,8 +33,6 @@ urlpatterns = [ path('support/', views.support, name="supportda"), path('setuserparent/', views.setuserparent, name="users-setuserparent"), path('sendpassmail/', views.sendpassmail, name="users-sendpassmail") - - ] diff --git a/users/views.py b/users/views.py index ba4bc8c..8d0b955 100644 --- a/users/views.py +++ b/users/views.py @@ -409,7 +409,6 @@ def GlobalSearch(request): else: return HttpResponse("Request method is not a GET") - def searchStandardRouter(request): if request.method == 'GET': return redirect('/standards/standard/'+request.GET['s_id']+'/single') @@ -443,9 +442,7 @@ def UsersAreaTaskUpdate(request, pk): area_ids.append(int(tempdata[1])) elif(tempdata[0] == 'task'): task_ids.append(int(tempdata[1])) - print(area_ids) - print(task_ids) - + areas = Areas.objects.filter(agency__pk=user.profile.agency.pk) tasks = Tasks.objects.filter(agency__pk=user.profile.agency.pk)