diff --git a/manager/templatetags/userstatus.py b/manager/templatetags/userstatus.py index 1026e04..4da5387 100644 --- a/manager/templatetags/userstatus.py +++ b/manager/templatetags/userstatus.py @@ -21,3 +21,7 @@ def updateUserStatus(user, sec = False): except Exception as e: return "" % str(e) return "" + +@register.simple_tag(takes_context=True) +def setUser(context): + return context.request.user diff --git a/manager/views.py b/manager/views.py index 25a8e2b..5de5ffd 100644 --- a/manager/views.py +++ b/manager/views.py @@ -255,12 +255,7 @@ def ping(request, device_id): @login_required def devices(request): - return render(request, "manager/index.html", - { - "title": "Device Administration", - "user": request.user - } - ) + return render(request, "manager/index.html", {"title": "Device Administration"}) @login_required def editdevice(request, device_id): @@ -318,7 +313,6 @@ def editdevice(request, device_id): "title": "Edit Device", "device": device[0], "subnets": subnets, - "user": request.user, "wifis": wifis, "curfis": Wifi.objects.filter(device=device[0]) } diff --git a/templates/base.html b/templates/base.html index 6d7f962..157d72e 100644 --- a/templates/base.html +++ b/templates/base.html @@ -13,6 +13,7 @@ {% load static %} {% load repo %} {% load userstatus %} + {% setUser as user %} {% updateUserStatus user %} {% block header %} {% endblock %}