Better use of history
This commit is contained in:
parent
8f5c4f3f0f
commit
d6b26c0a46
1 changed files with 4 additions and 1 deletions
|
@ -8,6 +8,7 @@ from math import floor
|
||||||
from queue import Queue
|
from queue import Queue
|
||||||
from django.db import models
|
from django.db import models
|
||||||
import profiles.models as profiles
|
import profiles.models as profiles
|
||||||
|
from tor_runner import TorInstance
|
||||||
from crawl import crawl
|
from crawl import crawl
|
||||||
from pinocchio.settings import HISTORY_MIN
|
from pinocchio.settings import HISTORY_MIN
|
||||||
|
|
||||||
|
@ -47,6 +48,7 @@ class History(models.Model):
|
||||||
""" Returns the history, sorted by increasing timestamps
|
""" Returns the history, sorted by increasing timestamps
|
||||||
"""
|
"""
|
||||||
history_set = self.history_set.order_by('timestamp')
|
history_set = self.history_set.order_by('timestamp')
|
||||||
|
history_set = [(item.search, item.timestamp.date()) for item in history_set]
|
||||||
return history_set
|
return history_set
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
@ -57,10 +59,11 @@ class History(models.Model):
|
||||||
return header + "\n".join(history_set)
|
return header + "\n".join(history_set)
|
||||||
|
|
||||||
|
|
||||||
def play_history(self):
|
def play_histories(self):
|
||||||
""" Actually plays the history.
|
""" Actually plays the history.
|
||||||
"""
|
"""
|
||||||
self.played = True
|
self.played = True
|
||||||
|
runner = TorInstance(self.history)
|
||||||
self.save()
|
self.save()
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue