diff --git a/standards/__pycache__/forms.cpython-38.pyc b/standards/__pycache__/forms.cpython-38.pyc index 3aa4028..c942996 100644 Binary files a/standards/__pycache__/forms.cpython-38.pyc and b/standards/__pycache__/forms.cpython-38.pyc differ diff --git a/standards/__pycache__/views.cpython-38.pyc b/standards/__pycache__/views.cpython-38.pyc index 08a5a43..4a00f86 100644 Binary files a/standards/__pycache__/views.cpython-38.pyc and b/standards/__pycache__/views.cpython-38.pyc differ diff --git a/standards/forms.py b/standards/forms.py index bbb20ba..77d6d0d 100644 --- a/standards/forms.py +++ b/standards/forms.py @@ -3,7 +3,10 @@ from django.forms import ModelForm from .models import Standards from areas.models import Areas from tasks.models import Tasks -from ckeditor.widgets import CKEditorWidget +#from ckeditor.widgets import CKEditorWidget + + + class StandardAddStandard(forms.ModelForm): @@ -13,7 +16,7 @@ class StandardAddStandard(forms.ModelForm): "name" : "Titel", "area" : "Übergeordneter Bereich", "task" : "Aufgabenbereich", - "content": "Inhalt" + "content": "Inhalt" } fields = ['name', 'area', 'task', 'content'] ''' diff --git a/standards/templates/standards/standards_management.html b/standards/templates/standards/standards_management.html index cad8ce5..5ce496e 100644 --- a/standards/templates/standards/standards_management.html +++ b/standards/templates/standards/standards_management.html @@ -1,4 +1,6 @@ {% extends "users/base.html" %} +{% load counter_tag %} + {% block content %}

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 0000000..af17d42 Binary files /dev/null and b/standards/templatetags/__pycache__/__init__.cpython-38.pyc differ 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 0000000..1ea8fa6 Binary files /dev/null and b/standards/templatetags/__pycache__/counter_tag.cpython-38.pyc differ 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 26e173d..24631cb 100644 Binary files a/users/__pycache__/urls.cpython-38.pyc and b/users/__pycache__/urls.cpython-38.pyc differ diff --git a/users/__pycache__/views.cpython-38.pyc b/users/__pycache__/views.cpython-38.pyc index 584db81..5f81dba 100644 Binary files a/users/__pycache__/views.cpython-38.pyc and b/users/__pycache__/views.cpython-38.pyc differ 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)