diff --git a/areas/templates/areas/areas_update.html b/areas/templates/areas/areas_update.html index 9ba7364..aae7a6f 100644 --- a/areas/templates/areas/areas_update.html +++ b/areas/templates/areas/areas_update.html @@ -125,7 +125,7 @@ } else{ tempid = null; - $("#addusertoareabtn").prop('disabled', true); + $("#addusertoareabtn").prop("disabled", true); } } diff --git a/orga/__pycache__/views.cpython-38.pyc b/orga/__pycache__/views.cpython-38.pyc index fc75078..f175d9a 100644 Binary files a/orga/__pycache__/views.cpython-38.pyc and b/orga/__pycache__/views.cpython-38.pyc differ diff --git a/orga/views.py b/orga/views.py index a87b8fc..7e73755 100644 --- a/orga/views.py +++ b/orga/views.py @@ -41,33 +41,42 @@ def singleorga(request, pk): VON GROß NACH KLEIN - SINNLOS prios = Prio.objects.filter(user__pk=pk).order_by('-prio')[::-1] ''' - 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')) - i = 0 - for area in areas: - areas[i].hex = areas[i].color - areas[i].color = list(webcolors.hex_to_rgb(areas[i].color)) - i += 1 + ''' + + Wenn eingelogger Nutzer nicht die gleiche Agency-ID hat, + gehts zum Dashboard - user_first_name = user.first_name - user_last_name = user.last_name - user_id = user.pk - context = { - 'active_link' : 'orga', - 'areas' : areas, - 'user_first_name' : user_first_name, - 'user_last_name' : user_last_name, - 'user_id' : user_id, - 'prios' : prios, - 'mail' : user.email, - 'userfunc' : user.profile.get_func_display, - 'imageurl' : user.profile.get_photo_url, - 'compfunc' : user.profile.compfunc, - 'phoneland' : user.profile.phoneland, - 'phonemobile' : user.profile.phonemobile - } - return render(request, 'orga/orga_single.html', context) + ''' + 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')) + i = 0 + for area in areas: + areas[i].hex = areas[i].color + areas[i].color = list(webcolors.hex_to_rgb(areas[i].color)) + i += 1 + + user_first_name = user.first_name + user_last_name = user.last_name + user_id = user.pk + context = { + 'active_link' : 'orga', + 'areas' : areas, + 'user_first_name' : user_first_name, + 'user_last_name' : user_last_name, + 'user_id' : user_id, + 'prios' : prios, + 'mail' : user.email, + 'userfunc' : user.profile.get_func_display, + 'imageurl' : user.profile.get_photo_url, + 'compfunc' : user.profile.compfunc, + 'phoneland' : user.profile.phoneland, + 'phonemobile' : user.profile.phonemobile + } + return render(request, 'orga/orga_single.html', context) + else: + return redirect('users-dashboard') diff --git a/users/__pycache__/views.cpython-38.pyc b/users/__pycache__/views.cpython-38.pyc index c8d9dee..23973ea 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/base.html b/users/templates/users/base.html index 1c5d7e2..a7874e5 100644 --- a/users/templates/users/base.html +++ b/users/templates/users/base.html @@ -197,17 +197,18 @@