8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-27 07:02:26 +00:00

Repasse sur l'ancienne utilisation de l'objet extension

This commit is contained in:
Gabriel Detraz 2017-08-06 20:00:29 +02:00 committed by root
parent 85703c407f
commit ddee0352bc
3 changed files with 3 additions and 4 deletions

View file

@ -243,7 +243,7 @@ class Domain(models.Model):
super(Domain, self).save(*args, **kwargs) super(Domain, self).save(*args, **kwargs)
def __str__(self): def __str__(self):
return str(self.name) + str(self.get_extension()) return str(self.name) + str(self.extension)
class IpList(models.Model): class IpList(models.Model):
PRETTY_NAME = "Addresses ipv4" PRETTY_NAME = "Addresses ipv4"
@ -300,4 +300,3 @@ def machine_post_save(sender, **kwargs):
machinetype = kwargs['instance'] machinetype = kwargs['instance']
for interface in machinetype.all_interfaces(): for interface in machinetype.all_interfaces():
interface.update_type() interface.update_type()

View file

@ -50,7 +50,7 @@ class InterfaceSerializer(serializers.ModelSerializer):
return obj.domain.name return obj.domain.name
def get_interface_extension(self, obj): def get_interface_extension(self, obj):
return obj.domain.get_extension().name return obj.domain.extension.name
def get_macaddress(self, obj): def get_macaddress(self, obj):
return str(obj.mac_address) return str(obj.mac_address)

View file

@ -52,7 +52,7 @@ from preferences.models import GeneralOption, OptionalMachine
def all_active_interfaces(): def all_active_interfaces():
"""Renvoie l'ensemble des machines autorisées à sortir sur internet """ """Renvoie l'ensemble des machines autorisées à sortir sur internet """
return Interface.objects.filter(machine__in=Machine.objects.filter(user__in=all_has_access()).filter(active=True)).select_related('domain').select_related('machine').select_related('type').select_related('ipv4').select_related('type__ip_type__extension').select_related('ipv4__ip_type').distinct() return Interface.objects.filter(machine__in=Machine.objects.filter(user__in=all_has_access()).filter(active=True)).select_related('domain').select_related('machine').select_related('type').select_related('ipv4').select_related('domain_extension').select_related('ipv4__ip_type').distinct()
def all_active_assigned_interfaces(): def all_active_assigned_interfaces():
""" Renvoie l'ensemble des machines qui ont une ipv4 assignées et disposant de l'accès internet""" """ Renvoie l'ensemble des machines qui ont une ipv4 assignées et disposant de l'accès internet"""