mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-09 03:16:25 +00:00
Fix date compare in machine history view
This commit is contained in:
parent
8aacef28f3
commit
fa439f9e9c
1 changed files with 17 additions and 0 deletions
|
@ -22,6 +22,8 @@
|
||||||
The models definitions for the Machines app
|
The models definitions for the Machines app
|
||||||
"""
|
"""
|
||||||
from reversion.models import Version
|
from reversion.models import Version
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
from machines.models import IpList
|
from machines.models import IpList
|
||||||
from machines.models import Interface
|
from machines.models import Interface
|
||||||
from machines.models import Machine
|
from machines.models import Machine
|
||||||
|
@ -72,6 +74,21 @@ class MachineHistory:
|
||||||
self.end = params.get("e", None)
|
self.end = params.get("e", None)
|
||||||
search_type = params.get("t", 0)
|
search_type = params.get("t", 0)
|
||||||
|
|
||||||
|
# Convert dates to datetime objects
|
||||||
|
if self.start:
|
||||||
|
self.start = datetime.datetime(
|
||||||
|
self.start.year,
|
||||||
|
self.start.month,
|
||||||
|
self.start.day
|
||||||
|
)
|
||||||
|
|
||||||
|
if self.end:
|
||||||
|
self.end = datetime.datetime(
|
||||||
|
self.end.year,
|
||||||
|
self.end.month,
|
||||||
|
self.end.day
|
||||||
|
)
|
||||||
|
|
||||||
self.events = []
|
self.events = []
|
||||||
if search_type == "ip":
|
if search_type == "ip":
|
||||||
return self.__get_by_ip(search)
|
return self.__get_by_ip(search)
|
||||||
|
|
Loading…
Reference in a new issue