Set user variable in template tag
This commit is contained in:
parent
60704455c6
commit
2c300ffc01
3 changed files with 6 additions and 7 deletions
|
@ -21,3 +21,7 @@ def updateUserStatus(user, sec = False):
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return "<!-- %s -->" % str(e)
|
return "<!-- %s -->" % str(e)
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
|
@register.simple_tag(takes_context=True)
|
||||||
|
def setUser(context):
|
||||||
|
return context.request.user
|
||||||
|
|
|
@ -255,12 +255,7 @@ def ping(request, device_id):
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def devices(request):
|
def devices(request):
|
||||||
return render(request, "manager/index.html",
|
return render(request, "manager/index.html", {"title": "Device Administration"})
|
||||||
{
|
|
||||||
"title": "Device Administration",
|
|
||||||
"user": request.user
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def editdevice(request, device_id):
|
def editdevice(request, device_id):
|
||||||
|
@ -318,7 +313,6 @@ def editdevice(request, device_id):
|
||||||
"title": "Edit Device",
|
"title": "Edit Device",
|
||||||
"device": device[0],
|
"device": device[0],
|
||||||
"subnets": subnets,
|
"subnets": subnets,
|
||||||
"user": request.user,
|
|
||||||
"wifis": wifis,
|
"wifis": wifis,
|
||||||
"curfis": Wifi.objects.filter(device=device[0])
|
"curfis": Wifi.objects.filter(device=device[0])
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,7 @@
|
||||||
{% load static %}
|
{% load static %}
|
||||||
{% load repo %}
|
{% load repo %}
|
||||||
{% load userstatus %}
|
{% load userstatus %}
|
||||||
|
{% setUser as user %}
|
||||||
{% updateUserStatus user %}
|
{% updateUserStatus user %}
|
||||||
{% block header %}
|
{% block header %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
Loading…
Reference in a new issue