summaryrefslogtreecommitdiff
path: root/ishtar_common/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r--ishtar_common/models.py19
1 files changed, 15 insertions, 4 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index 981ea74f2..7c8c8888d 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -329,7 +329,8 @@ class GeneralType(models.Model):
item.rank = 0
yield item
else:
- yield (item.pk, _(unicode(item)))
+ yield (item.pk, _(unicode(item))
+ if item and unicode(item) else '')
PREFIX = "› "
@@ -1369,8 +1370,8 @@ class ImportTarget(models.Model):
cls = self.column.importer_type.get_importer_class()
formt = cls().line_format[self.column.col_number - 1]
if hasattr(formt.formater, 'choices'):
- return formt.formater.choices
- return []
+ return [('', '--' * 8)] + list(formt.formater.choices)
+ return [('', '--' * 8)]
if self.formater_type.formater_type == 'StrToBoolean':
return [('', '--' * 8),
('True', _(u"True")),
@@ -1581,6 +1582,9 @@ class Import(models.Model):
result_file = models.FileField(_(u"Result file"),
upload_to="upload/imports/",
blank=True, null=True)
+ match_file = models.FileField(_(u"Match file"),
+ upload_to="upload/imports/",
+ blank=True, null=True)
state = models.CharField(_(u"State"), max_length=2, choices=IMPORT_STATE,
default='C')
creation_date = models.DateTimeField(_(u"Creation date"),
@@ -1684,6 +1688,13 @@ class Import(models.Model):
else:
self.state = 'F'
self.error_file = None
+ if importer.match_table:
+ match_file = filename + "_match_%s.csv" % now
+ match_file = os.sep.join([self.match_file.storage.location,
+ match_file])
+ with open(match_file, 'w') as fle:
+ fle.write(importer.get_csv_matches().encode('utf-8'))
+ self.match_file = File(open(fle.name))
self.save()
def archive(self):
@@ -1776,7 +1787,7 @@ class Person(Address, Merge, OwnPerms, ValueGetter):
)
TABLE_COLS = ('name', 'surname', 'email', 'person_types_list',
'attached_to')
- title = models.CharField(_(u"Title"), max_length=2, choices=TYPE,
+ title = models.CharField(_(u"Title"), max_length=100, choices=TYPE,
blank=True, null=True)
surname = models.CharField(_(u"Surname"), max_length=50, blank=True,
null=True)