diff options
Diffstat (limited to 'ishtar_common/models.py')
-rw-r--r-- | ishtar_common/models.py | 53 |
1 files changed, 43 insertions, 10 deletions
diff --git a/ishtar_common/models.py b/ishtar_common/models.py index 26734e70e..df21f5314 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -1124,11 +1124,34 @@ class Address(BaseHistorizedItem): town = models.CharField(_(u"Town"), max_length=70, null=True, blank=True) country = models.CharField(_(u"Country"), max_length=30, null=True, blank=True) + alt_address = models.TextField(_(u"Alternative address"), null=True, + blank=True) + alt_address_complement = models.TextField( + _(u"Alternative address complement"), null=True, blank=True) + alt_postal_code = models.CharField(_(u"Alternative address: postal code"), + max_length=10, null=True, blank=True) + alt_town = models.CharField(_(u"Alternative address: town"), max_length=70, + null=True, blank=True) + alt_country = models.CharField(_(u"Alternative address: Country"), + max_length=30, null=True, blank=True) phone = models.CharField(_(u"Phone"), max_length=18, null=True, blank=True) + phone_desc = models.CharField(_(u"Phone description"), max_length=300, + null=True, blank=True) + phone2 = models.CharField(_(u"Phone description 2"), max_length=18, + null=True, blank=True) + phone_desc2 = models.CharField(_(u"Phone description 2"), max_length=300, + null=True, blank=True) + phone3 = models.CharField(_(u"Phone 3"), max_length=18, null=True, + blank=True) + phone_desc3 = models.CharField(_(u"Phone description 3"), max_length=300, + null=True, blank=True) + raw_phone = models.TextField(_(u"Raw phone"), blank=True, null=True) mobile_phone = models.CharField(_(u"Mobile phone"), max_length=18, null=True, blank=True) email = models.EmailField( - _(u"Email"), max_length=75, blank=True, null=True) + _(u"Email"), max_length=300, blank=True, null=True) + alt_address_is_prefered = models.BooleanField( + _(u"Alternative address is prefered"), default=False) history = HistoricalRecords() class Meta: @@ -1146,19 +1169,24 @@ class Address(BaseHistorizedItem): def address_lbl(self): lbl = u'' - if self.address: - lbl += self.address - if self.address_complement: + prefix = '' + if self.alt_adress_is_prefered: + prefix = 'alt_' + if getattr(self, prefix + 'address'): + lbl += getattr(self, prefix + 'address') + if getattr(self, prefix + 'address_complement'): if lbl: lbl += "\n" - lbl += self.address_complement - if self.postal_code or self.town: + lbl += getattr(self, prefix + 'address_complement') + postal_code = getattr(self, prefix + 'postal_code') + town = getattr(self, prefix + 'town') + if postal_code or town: if lbl: lbl += "\n" lbl += u"{}{}{}".format( - self.postal_code or '', - " " if self.postal_code and self.town else '', - self.town or '') + postal_code or '', + " " if postal_code and town else '', + town or '') if self.phone: if lbl: lbl += u"\n" @@ -1248,6 +1276,8 @@ IMPORTER_CLASSES.update({ def get_importer_models(): MODELS = [ + ('ishtar_common.models.Person', _(u"Person")), + ('ishtar_common.models.Organization', _(u"Organization")), ('archaeological_operations.models.Operation', _(u"Operation")), ('archaeological_operations.models.ArchaeologicalSite', _(u"Archaeological site")), @@ -1956,7 +1986,7 @@ pre_delete.connect(pre_delete_import, sender=Import) class Organization(Address, Merge, OwnPerms, ValueGetter): TABLE_COLS = ('name', 'organization_type',) - name = models.CharField(_(u"Name"), max_length=300) + name = models.CharField(_(u"Name"), max_length=500) organization_type = models.ForeignKey(OrganizationType, verbose_name=_(u"Type")) history = HistoricalRecords() @@ -2034,6 +2064,9 @@ class Person(Address, Merge, OwnPerms, ValueGetter): null=True) raw_name = models.CharField(_(u"Raw name"), max_length=300, blank=True, null=True) + contact_type = models.CharField(_(u"Contact type"), max_length=300, + blank=True, null=True) + comment = models.TextField(_(u"Comment"), blank=True, null=True) person_types = models.ManyToManyField(PersonType, verbose_name=_(u"Types")) attached_to = models.ForeignKey( 'Organization', related_name='members', on_delete=models.SET_NULL, |