summaryrefslogtreecommitdiff
path: root/archaeological_finds/forms.py
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_finds/forms.py')
-rw-r--r--archaeological_finds/forms.py25
1 files changed, 12 insertions, 13 deletions
diff --git a/archaeological_finds/forms.py b/archaeological_finds/forms.py
index 8fa60ad5d..58c10971a 100644
--- a/archaeological_finds/forms.py
+++ b/archaeological_finds/forms.py
@@ -30,7 +30,7 @@ from django.db.models import Q
from django.forms.formsets import formset_factory
from django.utils.translation import ugettext_lazy as _
-import models
+from . import models
from archaeological_context_records.models import DatingType, DatingQuality, \
ContextRecord, RelationType as CRRelationType, Dating
from archaeological_finds.forms_treatments import TreatmentSelect, \
@@ -122,7 +122,7 @@ class RecordFormSelection(CustomForm, forms.Form):
except ContextRecord.DoesNotExist:
return
widget = self.fields['get_first_base_find__context_record'].widget
- widget.source = unicode(widget.source) + "?operation__pk={}".format(
+ widget.source = str(widget.source) + "?operation__pk={}".format(
cr.operation.pk)
@@ -260,7 +260,7 @@ class BaseFindForm(CustomForm, ManageOldType):
if clutter_long_side and clutter_short_side and \
clutter_short_side > clutter_long_side:
raise forms.ValidationError(
- unicode(_(
+ str(_(
u"Clutter: short side cannot be bigger than the long side."
))
)
@@ -353,15 +353,14 @@ class FindForm(BaseFindForm):
None)
if taq and not tpq:
raise forms.ValidationError(
- unicode(_(
+ str(_(
u"Discovery date: if a TAQ date is provided a TPQ date has "
u"to be informed. If you have a precise date fill only the "
u"TPQ - discovery date field."))
)
elif tpq and taq and taq < tpq:
raise forms.ValidationError(
- unicode(_(u"Discovery date: TAQ date must be older than TPQ "
- u"date.")))
+ str(_("Discovery date: TAQ date must be older than TPQ date.")))
if not get_current_profile().mapping:
return self.cleaned_data
@@ -385,7 +384,7 @@ class FindForm(BaseFindForm):
srs.srid)
except forms.ValidationError as e:
raise forms.ValidationError(
- unicode(_(u"Coordinates are not relevant for the spatial "
+ str(_(u"Coordinates are not relevant for the spatial "
u"reference system used: {}.")).format(e))
return self.cleaned_data
@@ -696,7 +695,7 @@ class QAFindBasketForm(IshtarForm):
if not self.user:
return
self.fields['basket'].choices = [
- (b.pk, u"{} ({})".format(b.label, b.items.count()))
+ (b.pk, "{} ({})".format(b.label, b.items.count()))
for b in models.FindBasket.objects.filter(user=self.user)
]
@@ -738,7 +737,7 @@ class QAFindbasketDuplicateForm(IshtarForm):
self.user = self.user.ishtaruser
self.basket = kwargs.pop('items')[0]
super(QAFindbasketDuplicateForm, self).__init__(*args, **kwargs)
- self.fields['label'].initial = self.basket.label + unicode(
+ self.fields['label'].initial = self.basket.label + str(
_(u" - duplicate"))
def clean(self):
@@ -811,10 +810,10 @@ class PreservationForm(CustomForm, ManageOldType):
def __init__(self, *args, **kwargs):
super(PreservationForm, self).__init__(*args, **kwargs)
self.fields['insurance_value'].label = u"{} ({})".format(
- unicode(self.fields['insurance_value'].label),
+ str(self.fields['insurance_value'].label),
get_current_profile().currency)
self.fields['estimated_value'].label = u"{} ({})".format(
- unicode(self.fields['estimated_value'].label),
+ str(self.fields['estimated_value'].label),
get_current_profile().currency)
@@ -1328,7 +1327,7 @@ def check_value(form_name, key, value):
'step_data'][form_name][form_name + '-' + key]
if val and len(val) > 0:
val = val[0]
- return unicode(val) == unicode(value)
+ return str(val) == str(value)
except ValueError:
return False
return func
@@ -1558,7 +1557,7 @@ class SelectFindBasketForm(IshtarForm):
def get_basket_choices(self):
return [('', u'--')] + [
- (str(b.pk), u"{} ({})".format(b.label, b.items.count()))
+ (str(b.pk), "{} ({})".format(b.label, b.items.count()))
for b in models.FindBasket.objects.filter(
Q(user=self.user) | Q(shared_write_with=self.user)
).distinct()