summaryrefslogtreecommitdiff
path: root/archaeological_finds/models_finds.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_finds/models_finds.py')
-rw-r--r--archaeological_finds/models_finds.py30
1 files changed, 17 insertions, 13 deletions
diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py
index b0c5a0332..68a7bfe51 100644
--- a/archaeological_finds/models_finds.py
+++ b/archaeological_finds/models_finds.py
@@ -408,11 +408,11 @@ class BaseFind(BulkUpdatedItem, BaseHistorizedItem, GeoItem, OwnPerms,
:return: True if index has been changed.
"""
profile = get_current_profile()
- if profile.find_index == u'O':
+ if profile.find_index == 'O':
operation = self.context_record.operation
q = BaseFind.objects \
.filter(context_record__operation=operation)
- elif profile.find_index == u'CR':
+ elif profile.find_index == 'CR':
cr = self.context_record
q = BaseFind.objects \
.filter(context_record=cr)
@@ -438,7 +438,7 @@ class BaseFind(BulkUpdatedItem, BaseHistorizedItem, GeoItem, OwnPerms,
elif ope.year and ope.operation_code:
c_id.append(
profile.default_operation_prefix +
- str(ope.year or '') + u"-" +
+ str(ope.year or '') + "-" +
str(ope.operation_code or ''))
else:
c_id.append('')
@@ -1732,19 +1732,19 @@ class Find(BulkUpdatedItem, ValueGetter, DocumentItem, BaseHistorizedItem,
@property
def name(self):
- return u" - ".join([base_find.name
+ return " - ".join([base_find.name
for base_find in self.base_finds.all()])
@property
def full_label(self):
- lbl = u" - ".join([getattr(self, attr)
+ lbl = " - ".join([getattr(self, attr)
for attr in (
'label', 'denomination', 'administrative_index')
if getattr(self, attr)])
- base = u" - ".join([base_find.complete_id()
+ base = " - ".join([base_find.complete_id()
for base_find in self.base_finds.all()])
if base:
- lbl += u' ({})'.format(base)
+ lbl += ' ({})'.format(base)
return lbl
def get_first_base_find(self):
@@ -1811,10 +1811,10 @@ class Find(BulkUpdatedItem, ValueGetter, DocumentItem, BaseHistorizedItem,
if self.id:
bf = self.get_first_base_find()
if not bf:
- return u"detached/{}".format(self.SLUG)
+ return "detached/{}".format(self.SLUG)
ope = bf.context_record.operation
- find_idx = u'{:0' + str(settings.ISHTAR_FINDS_INDEX_ZERO_LEN) + 'd}'
- return (u"{}/{}/" + find_idx).format(
+ find_idx = '{:0' + str(settings.ISHTAR_FINDS_INDEX_ZERO_LEN) + 'd}'
+ return ("{}/{}/" + find_idx).format(
ope._get_base_image_path(), self.SLUG, self.index)
@property
@@ -1831,7 +1831,7 @@ class Find(BulkUpdatedItem, ValueGetter, DocumentItem, BaseHistorizedItem,
self.index)
def context_records_lbl(self):
- return u" - ".join(
+ return " - ".join(
[bf.context_record.cached_label for bf in self.base_finds.all()]
)
context_records_lbl.short_description = _(u"Context record")
@@ -1931,7 +1931,9 @@ class Find(BulkUpdatedItem, ValueGetter, DocumentItem, BaseHistorizedItem,
return bf.context_record.operation.get_town_label()
@classmethod
- def get_periods(cls, slice='year', fltr={}):
+ def get_periods(cls, slice='year', fltr=None):
+ if not fltr:
+ fltr = {}
q = cls.objects
if fltr:
q = q.filter(**fltr)
@@ -1949,7 +1951,9 @@ class Find(BulkUpdatedItem, ValueGetter, DocumentItem, BaseHistorizedItem,
return list(years)
@classmethod
- def get_by_year(cls, year, fltr={}):
+ def get_by_year(cls, year, fltr=None):
+ if not fltr:
+ fltr = {}
q = cls.objects
if fltr:
q = q.filter(**fltr)