diff options
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r-- | ishtar_common/models.py | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 90e2bd6f6..c1edc13c6 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -22,6 +22,7 @@ Models description """ from cStringIO import StringIO import copy +import csv import datetime from PIL import Image from importlib import import_module @@ -2302,6 +2303,19 @@ class Import(models.Model): return bool(TargetKey.objects.filter(associated_import=self, is_set=False).count()) + @property + def errors(self): + if not self.error_file: + return [] + errors = [] + with open(self.error_file.path, 'rb') as csvfile: + reader = csv.DictReader(csvfile, fieldnames=['line', 'column', + 'error']) + reader.next() # pass the header + for row in reader: + errors.append(row) + return errors + def get_actions(self): """ Get available action relevant with the current status |