diff options
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r-- | ishtar_common/models.py | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 20b8a6f46..af1c70dce 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -1539,7 +1539,8 @@ TARGET_MODELS = [ ('archaeological_finds.models.PreservationType', _(u"Preservation type")), ('archaeological_finds.models.ObjectType', _(u"Object type")), ('archaeological_context_records.models.IdentificationType', - _("Identification type")) + _("Identification type")), + ('SupportType', _(u"Support type")), ] TARGET_MODELS_KEYS = [tm[0] for tm in TARGET_MODELS] @@ -1690,8 +1691,8 @@ class Import(models.Model): verbose_name_plural = _(u"Imports") def __unicode__(self): - return u"%s - %s" % (unicode(self.importer_type), - unicode(self.user)) + return u"%s - %s - %d" % (unicode(self.importer_type), + unicode(self.user), self.pk) def need_matching(self): return bool(TargetKey.objects.filter(associated_import=self, @@ -2150,14 +2151,15 @@ class Source(models.Model): creation_date = models.DateField(blank=True, null=True, verbose_name=_(u"Creation date")) item_number = models.IntegerField(_(u"Item number"), default=1) - reference = models.CharField(_(u"Ref."), max_length=25, null=True, + reference = models.CharField(_(u"Ref."), max_length=100, null=True, blank=True) - internal_reference = models.CharField(_(u"Internal reference"), - max_length=25, null=True, blank=True) + internal_reference = models.CharField( + _(u"Internal ref."), max_length=100, null=True, blank=True) description = models.TextField(_(u"Description"), blank=True, null=True) comment = models.TextField(_(u"Comment"), blank=True, null=True) additional_information = models.TextField(_(u"Additional information"), blank=True, null=True) + duplicate = models.BooleanField(_(u"Has a duplicate"), default=False) TABLE_COLS = ['title', 'source_type', 'authors', ] class Meta: @@ -2166,6 +2168,13 @@ class Source(models.Model): def __unicode__(self): return self.title + @property + def associated_filename(self): + values = [unicode(getattr(self, attr)) + for attr in ('source_type', 'title') + if getattr(self, attr)] + return slugify(u"-".join(values)) + if settings.COUNTRY == 'fr': class Arrondissement(models.Model): name = models.CharField(u"Nom", max_length=30) |