mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-22 23:13:46 +00:00
Fix #179 : permet la recherche qqsoit le format de macaddr
This commit is contained in:
parent
f803326e44
commit
8335e275b1
1 changed files with 7 additions and 0 deletions
|
@ -27,6 +27,8 @@ Gplv2"""
|
|||
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from netaddr import EUI, AddrFormatError
|
||||
|
||||
from django.shortcuts import render
|
||||
from django.contrib.auth.decorators import login_required
|
||||
|
||||
|
@ -171,6 +173,11 @@ def search_single_word(word, filters, user,
|
|||
) | Q(
|
||||
interface__ipv4__ipv4__icontains=word
|
||||
)
|
||||
try:
|
||||
_mac_addr = EUI(word)
|
||||
filter_machines |= Q(interface__mac_address=word)
|
||||
except AddrFormatError:
|
||||
pass
|
||||
if not Machine.can_view_all(user)[0]:
|
||||
filter_machines &= Q(user__id=user.id)
|
||||
filters['machines'] |= filter_machines
|
||||
|
|
Loading…
Reference in a new issue