From 5d4bd30e2009f5aa5786db3af38ac40ed94b3f03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Oudin?= Date: Mon, 26 Feb 2018 15:15:03 +0100 Subject: [PATCH] Exception handling --- histories/models.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/histories/models.py b/histories/models.py index a64bd1c..7a72ca9 100644 --- a/histories/models.py +++ b/histories/models.py @@ -9,6 +9,7 @@ from math import floor from xml.etree import ElementTree as ET from datetime import datetime from django.db import models +from django.core.exceptions import ValidationError import profiles.models as profiles from crawl import crawl from pinocchio.settings import HISTORY_MIN @@ -239,7 +240,10 @@ def generate_history(user, start_time): timestamp=datetime.fromtimestamp(timestamp), history=history ) - new_line.full_clean() - new_line.save() + try: + new_line.full_clean() + new_line.save() + except ValidationError: + pass return history