mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-22 19:33:11 +00:00
Code dupliqué, simplifie + django 1.10
This commit is contained in:
parent
20f141686b
commit
d264280ee3
2 changed files with 2 additions and 2 deletions
|
@ -4,7 +4,7 @@ from .settings import SITE_NAME
|
||||||
def context_user(request):
|
def context_user(request):
|
||||||
user = request.user
|
user = request.user
|
||||||
if user.is_authenticated():
|
if user.is_authenticated():
|
||||||
interfaces = Interface.objects.filter(machine=Machine.objects.filter(user=user, active=True))
|
interfaces = user.user_interfaces()
|
||||||
else:
|
else:
|
||||||
interfaces = None
|
interfaces = None
|
||||||
is_cableur = user.has_perms(('cableur',))
|
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())
|
and not self.is_ban() and (self.is_adherent() or self.is_whitelisted())
|
||||||
|
|
||||||
def user_interfaces(self):
|
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):
|
def has_module_perms(self, app_label):
|
||||||
# Simplest version again
|
# Simplest version again
|
||||||
|
|
Loading…
Reference in a new issue