Commit d264280e authored by Gabriel Detraz's avatar Gabriel Detraz Committed by root

Code dupliqué, simplifie + django 1.10

parent 20f14168
......@@ -4,7 +4,7 @@ from .settings import SITE_NAME
def context_user(request):
user = request.user
if user.is_authenticated():
interfaces = Interface.objects.filter(machine=Machine.objects.filter(user=user, active=True))
interfaces = user.user_interfaces()
else:
interfaces = None
is_cableur = user.has_perms(('cableur',))
......
......@@ -231,7 +231,7 @@ class User(AbstractBaseUser):
and not self.is_ban() and (self.is_adherent() or self.is_whitelisted())
def user_interfaces(self):
return Interface.objects.filter(machine__in=Machine.objects.filter(user=self))
return Interface.objects.filter(machine__in=Machine.objects.filter(user=self, active=True))
def has_module_perms(self, app_label):
# Simplest version again
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment