diff options
Diffstat (limited to 'archaeological_warehouse/models.py')
-rw-r--r-- | archaeological_warehouse/models.py | 70 |
1 files changed, 35 insertions, 35 deletions
diff --git a/archaeological_warehouse/models.py b/archaeological_warehouse/models.py index 0df76875f..15263fd88 100644 --- a/archaeological_warehouse/models.py +++ b/archaeological_warehouse/models.py @@ -70,11 +70,11 @@ class Warehouse(Address, DocumentItem, GeoItem, QRCodeItem, DashboardFormItem, # alternative names of fields for searches ALT_NAMES = { 'name': SearchAltName( - pgettext_lazy("key for text search", u"name"), + pgettext_lazy("key for text search", "name"), 'name__iexact' ), 'warehouse_type': SearchAltName( - pgettext_lazy("key for text search", u"type"), + pgettext_lazy("key for text search", "type"), 'warehouse_type__label__iexact' ), } @@ -115,7 +115,7 @@ class Warehouse(Address, DocumentItem, GeoItem, QRCodeItem, DashboardFormItem, ("delete_own_warehouse", u"Can delete own Warehouse"), ) - def __unicode__(self): + def __str__(self): return self.name def naturel_key(self): @@ -135,7 +135,7 @@ class Warehouse(Address, DocumentItem, GeoItem, QRCodeItem, DashboardFormItem, @property def associated_filename(self): return datetime.date.today().strftime('%Y-%m-%d') + '-' + \ - slugify(unicode(self)) + slugify(str(self)) @classmethod def get_query_owns(cls, ishtaruser): @@ -283,7 +283,7 @@ class Collection(LightHistorizedItem): verbose_name_plural = _(u"Collection") ordering = ('name',) - def __unicode__(self): + def __str__(self): return self.name @@ -309,7 +309,7 @@ class WarehouseDivisionLink(models.Model): ordering = ('warehouse', 'order') unique_together = ('warehouse', 'division') - def __unicode__(self): + def __str__(self): return u"{} - {}".format(self.warehouse, self.division) @@ -378,99 +378,99 @@ class Container(DocumentItem, LightHistorizedItem, QRCodeItem, GeoItem, # alternative names of fields for searches ALT_NAMES = { 'location_name': SearchAltName( - pgettext_lazy("key for text search", u"location"), + pgettext_lazy("key for text search", "location"), 'location__name__iexact' ), 'responsible_name': SearchAltName( - pgettext_lazy("key for text search", u"responsible-warehouse"), + pgettext_lazy("key for text search", "responsible-warehouse"), 'responsible__name__iexact' ), 'container_type': SearchAltName( - pgettext_lazy("key for text search", u"type"), + pgettext_lazy("key for text search", "type"), 'container_type__label__iexact' ), 'reference': SearchAltName( - pgettext_lazy("key for text search", u"reference"), + pgettext_lazy("key for text search", "reference"), 'reference__iexact' ), 'old_reference': SearchAltName( - pgettext_lazy("key for text search", u"old-reference"), + pgettext_lazy("key for text search", "old-reference"), 'old_reference__iexact' ), 'comment': SearchAltName( - pgettext_lazy("key for text search", u"comment"), + pgettext_lazy("key for text search", "comment"), 'comment__iexact' ), 'code_patriarche': SearchAltName( - pgettext_lazy("key for text search", u"code-patriarche"), + pgettext_lazy("key for text search", "code-patriarche"), 'finds__base_finds__context_record__operation__' 'code_patriarche__iexact' ), 'archaeological_sites': SearchAltName( - pgettext_lazy("key for text search", u"site"), + pgettext_lazy("key for text search", "site"), 'finds__base_finds__context_record__operation__' 'archaeological_sites__cached_label__icontains'), 'archaeological_sites_name': SearchAltName( - pgettext_lazy("key for text search", u"site-name"), + pgettext_lazy("key for text search", "site-name"), 'finds__base_finds__context_record__operation__' 'archaeological_sites__name__iexact'), 'archaeological_sites_context_record': SearchAltName( - pgettext_lazy("key for text search", u"context-record-site"), + pgettext_lazy("key for text search", "context-record-site"), 'finds__base_finds__context_record__archaeological_site__' 'cached_label__icontains'), 'archaeological_sites_context_record_name': SearchAltName( pgettext_lazy("key for text search", - u"context-record-site-name"), + "context-record-site-name"), 'finds__base_finds__context_record__archaeological_site__' 'name__iexact'), 'context_record': SearchAltName( - pgettext_lazy("key for text search", u"context-record"), + pgettext_lazy("key for text search", "context-record"), 'finds__base_finds__context_record__cached_label__icontains'), 'material_types': SearchAltName( - pgettext_lazy("key for text search", u"material"), + pgettext_lazy("key for text search", "material"), 'finds__material_types__label__iexact'), 'object_types': SearchAltName( - pgettext_lazy("key for text search", u"object-type"), + pgettext_lazy("key for text search", "object-type"), 'finds__object_types__label__iexact'), 'preservation_to_considers': SearchAltName( - pgettext_lazy("key for text search", u"preservation"), + pgettext_lazy("key for text search", "preservation"), 'finds__preservation_to_considers__label__iexact'), 'conservatory_state': SearchAltName( - pgettext_lazy("key for text search", u"conservatory"), + pgettext_lazy("key for text search", "conservatory"), 'finds__conservatory_state__label__iexact'), 'integrities': SearchAltName( - pgettext_lazy("key for text search", u"integrity"), + pgettext_lazy("key for text search", "integrity"), 'finds__integrities__label__iexact'), 'remarkabilities': SearchAltName( - pgettext_lazy("key for text search", u"remarkability"), + pgettext_lazy("key for text search", "remarkability"), 'finds__remarkabilities__label__iexact'), 'alterations': SearchAltName( - pgettext_lazy(u"key for text search", u"alterations"), + pgettext_lazy("key for text search", "alterations"), 'finds__alterations__label__iexact'), 'alteration_causes': SearchAltName( - pgettext_lazy(u"key for text search", u"alteration-causes"), + pgettext_lazy("key for text search", "alteration-causes"), 'finds__alteration_causes__label__iexact'), 'treatment_emergency': SearchAltName( - pgettext_lazy(u"key for text search", u"treatment-emergency"), + pgettext_lazy("key for text search", "treatment-emergency"), 'finds__treatment_emergency__label__iexact'), 'description': SearchAltName( - pgettext_lazy("key for text search", u"find-description"), + pgettext_lazy("key for text search", "find-description"), 'finds__description__iexact'), 'empty': SearchAltName( pgettext_lazy("key for text search", u"empty"), @@ -488,7 +488,7 @@ class Container(DocumentItem, LightHistorizedItem, QRCodeItem, GeoItem, DYNAMIC_REQUESTS = { 'division': DynamicRequest( - label=_(u"Division -"), + label=_("Division -"), app_name='archaeological_warehouse', model_name='WarehouseDivision', form_key='division', search_key=pgettext_lazy("key for text search", @@ -543,7 +543,7 @@ class Container(DocumentItem, LightHistorizedItem, QRCodeItem, GeoItem, ("delete_own_container", u"Can delete own Container"), ) - def __unicode__(self): + def __str__(self): return self.cached_label def natural_key(self): @@ -555,7 +555,7 @@ class Container(DocumentItem, LightHistorizedItem, QRCodeItem, GeoItem, return cached_label def _generate_cached_location(self): - items = [self.location.name, unicode(self.index)] + items = [self.location.name, str(self.index)] cached_label = u" - ".join(items) return cached_label @@ -606,7 +606,7 @@ class Container(DocumentItem, LightHistorizedItem, QRCodeItem, GeoItem, filename = datetime.date.today().strftime('%Y-%m-%d') filename += u'-' + self.reference filename += u"-" + self.location.name - filename += u"-" + unicode(self.index) + filename += u"-" + str(self.index) if self.cached_division is None: self.skip_history_when_saving = True self.save() @@ -816,9 +816,9 @@ class ContainerLocalisation(models.Model): unique_together = ('container', 'division') ordering = ('container', 'division__order') - def __unicode__(self): - lbl = u" - ".join((unicode(self.container), - unicode(self.division), self.reference)) + def __str__(self): + lbl = u" - ".join((str(self.container), + str(self.division), self.reference)) return lbl def save(self, *args, **kwargs): |