From 92e408f30f3285ecafbbd442a05dfa07f2c33ae3 Mon Sep 17 00:00:00 2001 From: Jean-Romain Garnier Date: Sun, 3 May 2020 00:47:49 +0200 Subject: [PATCH] Fix mac address filter no longer working --- logs/models.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/logs/models.py b/logs/models.py index 3d50988d..f4fb23f6 100644 --- a/logs/models.py +++ b/logs/models.py @@ -50,8 +50,8 @@ def make_version_filter(key, value): :param value: str or int, The argument's value :returns: A Q filter """ - # The lookup is done in a json string, so the lookup has to be formated - # based on the value's type + # The lookup is done in a json string, so it has to be formated + # based on the value's type (to add " or not) if type(value) is str: formatted_value = "\"{}\"".format(value) else: @@ -196,7 +196,7 @@ class MachineHistorySearch: """ return ( Version.objects.get_for_model(Interface) - .filter(make_version_filter("mac_address", mac)) + .filter(make_version_filter("mac_address", str(mac))) .order_by("revision__date_created") )