From d6b26c0a4689bc8f841844fbf12e34af05abaa21 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Oudin?= Date: Mon, 26 Feb 2018 10:05:33 +0100 Subject: [PATCH] Better use of history --- histories/models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/histories/models.py b/histories/models.py index 7bcf5b2..649aff8 100644 --- a/histories/models.py +++ b/histories/models.py @@ -8,6 +8,7 @@ from math import floor from queue import Queue from django.db import models import profiles.models as profiles +from tor_runner import TorInstance from crawl import crawl from pinocchio.settings import HISTORY_MIN @@ -47,6 +48,7 @@ class History(models.Model): """ Returns the history, sorted by increasing timestamps """ history_set = self.history_set.order_by('timestamp') + history_set = [(item.search, item.timestamp.date()) for item in history_set] return history_set def __str__(self): @@ -57,10 +59,11 @@ class History(models.Model): return header + "\n".join(history_set) - def play_history(self): + def play_histories(self): """ Actually plays the history. """ self.played = True + runner = TorInstance(self.history) self.save()