Merge remote-tracking branch 'origin/Django' into Django
This commit is contained in:
@@ -16,10 +16,18 @@ def home(request):
|
||||
perm = request.session.get("permission")
|
||||
if perm is None and uid is not None:
|
||||
u = get_user_by_id(uid)
|
||||
perm = (u or {}).get("permission", 1)
|
||||
try:
|
||||
perm = int((u or {}).get("permission", 1))
|
||||
except Exception:
|
||||
perm = 1
|
||||
request.session["permission"] = perm
|
||||
else:
|
||||
try:
|
||||
perm = int(perm)
|
||||
except Exception:
|
||||
perm = 1
|
||||
context = {
|
||||
"user_id": uid,
|
||||
"is_admin": (perm == 0),
|
||||
"is_admin": (int(perm) == 0),
|
||||
}
|
||||
return render(request, "main/home.html", context)
|
||||
Reference in New Issue
Block a user