summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2021-02-12 17:53:44 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2021-02-28 12:15:24 +0100
commit60a80e0bc33798a36e1a29253c8123f1d19bd2a5 (patch)
tree9bf31ced127fc7389d9ba6f9d55279fd21debcfb
parent0d860bb0211ce14bbb86ffe7411ec2853852b64d (diff)
downloadIshtar-60a80e0bc33798a36e1a29253c8123f1d19bd2a5.tar.bz2
Ishtar-60a80e0bc33798a36e1a29253c8123f1d19bd2a5.zip
Refactoring - typo
-rw-r--r--archaeological_files/models.py4
-rw-r--r--archaeological_finds/admin.py6
-rw-r--r--archaeological_finds/forms.py514
-rw-r--r--archaeological_finds/forms_treatments.py272
-rw-r--r--archaeological_finds/ishtar_menu.py68
-rw-r--r--archaeological_finds/lookups.py8
-rw-r--r--archaeological_finds/models_finds.py10
-rw-r--r--archaeological_finds/models_treatments.py219
-rw-r--r--archaeological_finds/views.py103
-rw-r--r--archaeological_finds/wizards.py29
-rw-r--r--archaeological_operations/forms.py8
-rw-r--r--archaeological_operations/models.py12
-rw-r--r--archaeological_operations/utils.py10
-rw-r--r--archaeological_operations/widgets.py2
-rw-r--r--docs/old/source/conf.py2
-rw-r--r--example_project/local_settings.py.sample2
-rw-r--r--example_project/settings.py4
-rw-r--r--ishtar_common/admin.py2
-rw-r--r--ishtar_common/forms.py6
-rw-r--r--ishtar_common/forms_common.py2
-rw-r--r--ishtar_common/models_imports.py6
-rw-r--r--ishtar_common/tests.py2
-rw-r--r--setup.py2
23 files changed, 654 insertions, 639 deletions
diff --git a/archaeological_files/models.py b/archaeological_files/models.py
index 5b2c89e16..8f27f7ec2 100644
--- a/archaeological_files/models.py
+++ b/archaeological_files/models.py
@@ -321,7 +321,7 @@ class File(ClosedItem, DocumentItem, BaseHistorizedItem, CompleteIdentifierItem,
SaisineType, blank=True, null=True,
on_delete=models.SET_NULL,
verbose_name="Type de saisine")
- instruction_deadline = models.DateField(_(u'Instruction deadline'),
+ instruction_deadline = models.DateField(_('Instruction deadline'),
blank=True, null=True)
total_surface = models.FloatField(_("Total surface (m2)"),
blank=True, null=True)
@@ -589,7 +589,7 @@ class File(ClosedItem, DocumentItem, BaseHistorizedItem, CompleteIdentifierItem,
return Parcel.grouped_parcels(list(self.parcels.all()))
def get_town_label(self):
- lbl = str(_(u'Multi-town'))
+ lbl = str(_('Multi-town'))
if self.main_town:
lbl = self.main_town.name
elif self.towns.count() == 1:
diff --git a/archaeological_finds/admin.py b/archaeological_finds/admin.py
index 00f5501b5..e3c573e65 100644
--- a/archaeological_finds/admin.py
+++ b/archaeological_finds/admin.py
@@ -37,11 +37,11 @@ class AdminBaseFindForm(forms.ModelForm):
class Meta:
model = models.BaseFind
exclude = []
- point_2d = PointField(label=_(u"Point (2D)"), required=False,
+ point_2d = PointField(label=_("Point (2D)"), required=False,
widget=OSMWidget)
- line = LineStringField(label=_(u"Line"), required=False,
+ line = LineStringField(label=_("Line"), required=False,
widget=OSMWidget)
- multi_polygon = MultiPolygonField(label=_(u"Multi polygon"), required=False,
+ multi_polygon = MultiPolygonField(label=_("Multi polygon"), required=False,
widget=OSMWidget)
context_record = AutoCompleteSelectField('context_record')
diff --git a/archaeological_finds/forms.py b/archaeological_finds/forms.py
index be4465537..dad663624 100644
--- a/archaeological_finds/forms.py
+++ b/archaeological_finds/forms.py
@@ -104,7 +104,7 @@ class RecordFormSelection(CustomForm, forms.Form):
base_models = ['get_first_base_find']
associated_models = {'get_first_base_find__context_record': ContextRecord}
get_first_base_find__context_record = forms.IntegerField(
- label=_(u"Context record"),
+ label=_("Context record"),
widget=widgets.JQueryAutoComplete(
reverse_lazy('autocomplete-contextrecord'),
associated_model=ContextRecord),
@@ -164,17 +164,17 @@ class BasicFindForm(CustomForm, ManageOldType):
'clutter_height', 'dimensions_comment', 'checked_type', 'check_date'
]
HEADERS = {}
- HEADERS['label'] = FormHeader(_(u"Identification"))
+ HEADERS['label'] = FormHeader(_("Identification"))
label = forms.CharField(
- label=_(u"Free ID"),
+ label=_("Free ID"),
validators=[validators.MaxLengthValidator(60)])
- denomination = forms.CharField(label=_(u"Denomination"), required=False)
+ denomination = forms.CharField(label=_("Denomination"), required=False)
previous_id = forms.CharField(label=_("Previous ID"), required=False)
- museum_id = forms.CharField(label=_(u"Museum ID"), required=False)
- laboratory_id = forms.CharField(label=_(u"Laboratory ID"), required=False)
- seal_number = forms.CharField(label=_(u"Seal number"), required=False)
- mark = forms.CharField(label=_(u"Mark"), required=False)
+ museum_id = forms.CharField(label=_("Museum ID"), required=False)
+ laboratory_id = forms.CharField(label=_("Laboratory ID"), required=False)
+ seal_number = forms.CharField(label=_("Seal number"), required=False)
+ mark = forms.CharField(label=_("Mark"), required=False)
#collection = forms.IntegerField(
# label=_("Collection (warehouse)"),
# widget=widgets.JQueryAutoComplete(
@@ -182,80 +182,80 @@ class BasicFindForm(CustomForm, ManageOldType):
# associated_model=Warehouse, new=True),
# validators=[valid_id(Warehouse)], required=False)
- HEADERS['description'] = FormHeader(_(u"Description"))
- description = forms.CharField(label=_(u"Description"),
+ HEADERS['description'] = FormHeader(_("Description"))
+ description = forms.CharField(label=_("Description"),
widget=forms.Textarea, required=False)
public_description = forms.CharField(
label=_("Public description"), widget=forms.Textarea, required=False)
- is_complete = forms.NullBooleanField(label=_(u"Is complete?"),
+ is_complete = forms.NullBooleanField(label=_("Is complete?"),
required=False)
material_type = widgets.Select2MultipleField(
- label=_(u"Material types"), required=False
+ label=_("Material types"), required=False
)
material_type_quality = forms.ChoiceField(
- label=_(u"Material type quality"), required=False, choices=[])
+ label=_("Material type quality"), required=False, choices=[])
material_comment = forms.CharField(
- label=_(u"Comment on the material"), required=False,
+ label=_("Comment on the material"), required=False,
widget=forms.Textarea)
object_type = widgets.Select2MultipleField(
- label=_(u"Object types"), required=False,
+ label=_("Object types"), required=False,
)
object_type_quality = forms.ChoiceField(
- label=_(u"Object type quality"), required=False, choices=[])
- find_number = forms.IntegerField(label=_(u"Find number"), required=False)
+ label=_("Object type quality"), required=False, choices=[])
+ find_number = forms.IntegerField(label=_("Find number"), required=False)
min_number_of_individuals = forms.IntegerField(
- label=_(u"Minimum number of individuals (MNI)"), required=False)
+ label=_("Minimum number of individuals (MNI)"), required=False)
- decoration = forms.CharField(label=_(u"Decoration"), widget=forms.Textarea,
+ decoration = forms.CharField(label=_("Decoration"), widget=forms.Textarea,
required=False)
- inscription = forms.CharField(label=_(u"Inscription"),
+ inscription = forms.CharField(label=_("Inscription"),
widget=forms.Textarea, required=False)
manufacturing_place = forms.CharField(
- label=_(u"Manufacturing place"), required=False)
+ label=_("Manufacturing place"), required=False)
communicabilitie = widgets.Select2MultipleField(
- label=_(u"Communicability"), required=False
+ label=_("Communicability"), required=False
)
- comment = forms.CharField(label=_(u"Comment"), required=False,
+ comment = forms.CharField(label=_("Comment"), required=False,
widget=forms.Textarea)
cultural_attribution = widgets.Select2MultipleField(
label=_("Cultural attribution"), required=False,
)
dating_comment = forms.CharField(
- label=_(u"Comment on dating"), required=False, widget=forms.Textarea)
+ label=_("Comment on dating"), required=False, widget=forms.Textarea)
- HEADERS['length'] = FormHeader(_(u"Dimensions"))
- length = FloatField(label=_(u"Length (cm)"),
+ HEADERS['length'] = FormHeader(_("Dimensions"))
+ length = FloatField(label=_("Length (cm)"),
widget=widgets.CentimeterMeterWidget, required=False)
- width = FloatField(label=_(u"Width (cm)"), required=False,
+ width = FloatField(label=_("Width (cm)"), required=False,
widget=widgets.CentimeterMeterWidget)
- height = FloatField(label=_(u"Height (cm)"),
+ height = FloatField(label=_("Height (cm)"),
widget=widgets.CentimeterMeterWidget, required=False)
- thickness = FloatField(label=_(u"Thickness (cm)"),
+ thickness = FloatField(label=_("Thickness (cm)"),
widget=widgets.CentimeterMeterWidget, required=False)
- diameter = FloatField(label=_(u"Diameter (cm)"),
+ diameter = FloatField(label=_("Diameter (cm)"),
widget=widgets.CentimeterMeterWidget, required=False)
circumference = FloatField(
- label=_(u"Circumference (cm)"), widget=widgets.CentimeterMeterWidget,
+ label=_("Circumference (cm)"), widget=widgets.CentimeterMeterWidget,
required=False)
- volume = FloatField(label=_(u"Volume (l)"), required=False)
- weight = FloatField(label=_(u"Weight (g)"),
+ volume = FloatField(label=_("Volume (l)"), required=False)
+ weight = FloatField(label=_("Weight (g)"),
widget=widgets.GramKilogramWidget, required=False)
clutter_long_side = FloatField(
- label=_(u"Clutter long side (cm)"),
+ label=_("Clutter long side (cm)"),
widget=widgets.CentimeterMeterWidget, required=False)
clutter_short_side = FloatField(
- label=_(u"Clutter short side (cm)"),
+ label=_("Clutter short side (cm)"),
widget=widgets.CentimeterMeterWidget, required=False)
clutter_height = FloatField(
- label=_(u"Clutter height (cm)"),
+ label=_("Clutter height (cm)"),
widget=widgets.CentimeterMeterWidget, required=False)
dimensions_comment = forms.CharField(
- label=_(u"Dimensions comment"), required=False, widget=forms.Textarea)
+ label=_("Dimensions comment"), required=False, widget=forms.Textarea)
- HEADERS['checked_type'] = FormHeader(_(u"Sheet"))
- checked_type = forms.ChoiceField(label=_(u"Check"), required=False)
+ HEADERS['checked_type'] = FormHeader(_("Sheet"))
+ checked_type = forms.ChoiceField(label=_("Check"), required=False)
check_date = forms.DateField(
- initial=get_now, label=_(u"Check date"), widget=DatePicker)
+ initial=get_now, label=_("Check date"), widget=DatePicker)
TYPES = [
FieldType('material_type', models.MaterialType, is_multiple=True,
@@ -286,7 +286,7 @@ class BasicFindForm(CustomForm, ManageOldType):
clutter_short_side > clutter_long_side:
raise forms.ValidationError(
str(_(
- u"Clutter: short side cannot be bigger than the long side."
+ "Clutter: short side cannot be bigger than the long side."
))
)
return self.cleaned_data
@@ -329,32 +329,32 @@ class FindForm(BasicFindForm):
HEADERS = BasicFindForm.HEADERS.copy()
get_first_base_find__excavation_id = forms.CharField(
- label=_(u"Excavation ID"), required=False)
+ label=_("Excavation ID"), required=False)
get_first_base_find__discovery_date = forms.DateField(
- label=_(u"Discovery date (exact or TPQ)"), widget=DatePicker,
+ label=_("Discovery date (exact or TPQ)"), widget=DatePicker,
required=False)
get_first_base_find__discovery_date_taq = forms.DateField(
- label=_(u"Discovery date (TAQ)"), widget=DatePicker, required=False)
+ label=_("Discovery date (TAQ)"), widget=DatePicker, required=False)
get_first_base_find__batch = forms.ChoiceField(
- label=_(u"Batch/object"), choices=[],
+ label=_("Batch/object"), choices=[],
required=False)
- HEADERS['get_first_base_find__x'] = FormHeader(_(u"Coordinates"))
- get_first_base_find__x = forms.FloatField(label=_(u"X"), required=False)
+ HEADERS['get_first_base_find__x'] = FormHeader(_("Coordinates"))
+ get_first_base_find__x = forms.FloatField(label=_("X"), required=False)
get_first_base_find__estimated_error_x = \
- forms.FloatField(label=_(u"Estimated error for X"), required=False)
- get_first_base_find__y = forms.FloatField(label=_(u"Y"), required=False)
+ forms.FloatField(label=_("Estimated error for X"), required=False)
+ get_first_base_find__y = forms.FloatField(label=_("Y"), required=False)
get_first_base_find__estimated_error_y = \
- forms.FloatField(label=_(u"Estimated error for Y"), required=False)
- get_first_base_find__z = forms.FloatField(label=_(u"Z"), required=False)
+ forms.FloatField(label=_("Estimated error for Y"), required=False)
+ get_first_base_find__z = forms.FloatField(label=_("Z"), required=False)
get_first_base_find__estimated_error_z = \
- forms.FloatField(label=_(u"Estimated error for Z"), required=False)
+ forms.FloatField(label=_("Estimated error for Z"), required=False)
get_first_base_find__spatial_reference_system = \
- forms.ChoiceField(label=_(u"Spatial Reference System"), required=False,
+ forms.ChoiceField(label=_("Spatial Reference System"), required=False,
choices=[])
get_first_base_find__topographic_localisation = forms.CharField(
- label=_(u"Point of topographic reference"),
+ label=_("Point of topographic reference"),
required=False, max_length=120
)
@@ -385,9 +385,9 @@ class FindForm(BasicFindForm):
if taq and not tpq:
raise forms.ValidationError(
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."))
+ "Discovery date: if a TAQ date is provided a TPQ date has "
+ "to be informed. If you have a precise date fill only the "
+ "TPQ - discovery date field."))
)
elif tpq and taq and taq < tpq:
raise forms.ValidationError(
@@ -406,8 +406,8 @@ class FindForm(BasicFindForm):
srs = None
if x and y and not srs:
raise forms.ValidationError(
- _(u"You should at least provide X, Y and the spatial "
- u"reference system used."))
+ _("You should at least provide X, Y and the spatial "
+ "reference system used."))
if x and y and srs:
try:
convert_coordinates_to_point(
@@ -429,7 +429,7 @@ class SimpleFindForm(BasicFindForm):
class ResultingFindForm(CustomForm, ManageOldType):
file_upload = True
form_label = _("Resulting find")
- form_admin_name = _(u"Treatment n-1 - 030 - Resulting find")
+ form_admin_name = _("Treatment n-1 - 030 - Resulting find")
form_slug = "treatmentn1-030-resulting-find"
associated_models = {
@@ -441,72 +441,72 @@ class ResultingFindForm(CustomForm, ManageOldType):
'resulting_checked_type': models.CheckedType,
}
HEADERS = {}
- HEADERS['resulting_label'] = FormHeader(_(u"Identification"))
+ HEADERS['resulting_label'] = FormHeader(_("Identification"))
resulting_label = forms.CharField(
- label=_(u"Free ID"),
+ label=_("Free ID"),
validators=[validators.MaxLengthValidator(60)])
- resulting_denomination = forms.CharField(label=_(u"Denomination"),
+ resulting_denomination = forms.CharField(label=_("Denomination"),
required=False)
- HEADERS['resulting_description'] = FormHeader(_(u"Description"))
+ HEADERS['resulting_description'] = FormHeader(_("Description"))
resulting_description = forms.CharField(
- label=_(u"Description"), widget=forms.Textarea, required=False)
+ label=_("Description"), widget=forms.Textarea, required=False)
resulting_is_complete = forms.NullBooleanField(
- label=_(u"Is complete?"), required=False)
+ label=_("Is complete?"), required=False)
resulting_material_type = widgets.Select2MultipleField(
- label=_(u"Material types"), required=False
+ label=_("Material types"), required=False
)
resulting_material_type_quality = forms.ChoiceField(
- label=_(u"Material type quality"), required=False, choices=[])
+ label=_("Material type quality"), required=False, choices=[])
resulting_object_type = widgets.Select2MultipleField(
- label=_(u"Object types"), required=False,
+ label=_("Object types"), required=False,
)
resulting_object_type_quality = forms.ChoiceField(
- label=_(u"Object type quality"), required=False, choices=[])
+ label=_("Object type quality"), required=False, choices=[])
resulting_find_number = forms.IntegerField(
- label=_(u"Find number"), required=False)
+ label=_("Find number"), required=False)
resulting_min_number_of_individuals = forms.IntegerField(
- label=_(u"Minimum number of individuals (MNI)"), required=False)
+ label=_("Minimum number of individuals (MNI)"), required=False)
resulting_decoration = forms.CharField(
- label=_(u"Decoration"), widget=forms.Textarea, required=False)
+ label=_("Decoration"), widget=forms.Textarea, required=False)
resulting_inscription = forms.CharField(
- label=_(u"Inscription"), widget=forms.Textarea, required=False)
+ label=_("Inscription"), widget=forms.Textarea, required=False)
resulting_manufacturing_place = forms.CharField(
- label=_(u"Manufacturing place"), required=False)
+ label=_("Manufacturing place"), required=False)
resulting_communicabilitie = widgets.Select2MultipleField(
- label=_(u"Communicability"), required=False
+ label=_("Communicability"), required=False
)
- resulting_comment = forms.CharField(label=_(u"Comment"), required=False,
+ resulting_comment = forms.CharField(label=_("Comment"), required=False,
widget=forms.Textarea)
resulting_dating_comment = forms.CharField(
- label=_(u"Comment on dating"), required=False, widget=forms.Textarea)
-
- HEADERS['resulting_length'] = FormHeader(_(u"Dimensions"))
- resulting_length = FloatField(label=_(u"Length (cm)"), required=False)
- resulting_width = FloatField(label=_(u"Width (cm)"), required=False)
- resulting_height = FloatField(label=_(u"Height (cm)"), required=False)
- resulting_diameter = FloatField(label=_(u"Diameter (cm)"), required=False)
- resulting_circumference = FloatField(label=_(u"Circumference (cm)"),
+ label=_("Comment on dating"), required=False, widget=forms.Textarea)
+
+ HEADERS['resulting_length'] = FormHeader(_("Dimensions"))
+ resulting_length = FloatField(label=_("Length (cm)"), required=False)
+ resulting_width = FloatField(label=_("Width (cm)"), required=False)
+ resulting_height = FloatField(label=_("Height (cm)"), required=False)
+ resulting_diameter = FloatField(label=_("Diameter (cm)"), required=False)
+ resulting_circumference = FloatField(label=_("Circumference (cm)"),
required=False)
- resulting_thickness = FloatField(label=_(u"Thickness (cm)"), required=False)
- resulting_volume = FloatField(label=_(u"Volume (l)"), required=False)
- resulting_weight = FloatField(label=_(u"Weight (g)"), required=False)
+ resulting_thickness = FloatField(label=_("Thickness (cm)"), required=False)
+ resulting_volume = FloatField(label=_("Volume (l)"), required=False)
+ resulting_weight = FloatField(label=_("Weight (g)"), required=False)
resulting_clutter_long_side = FloatField(
- label=_(u"Clutter long side (cm)"), required=False)
+ label=_("Clutter long side (cm)"), required=False)
resulting_clutter_short_side = FloatField(
- label=_(u"Clutter short side (cm)"), required=False)
+ label=_("Clutter short side (cm)"), required=False)
resulting_clutter_height = FloatField(
- label=_(u"Clutter height (cm)"), required=False)
+ label=_("Clutter height (cm)"), required=False)
resulting_dimensions_comment = forms.CharField(
- label=_(u"Dimensions comment"), required=False, widget=forms.Textarea)
+ label=_("Dimensions comment"), required=False, widget=forms.Textarea)
- HEADERS['resulting_checked_type'] = FormHeader(_(u"Sheet"))
- resulting_checked_type = forms.ChoiceField(label=_(u"Check"),
+ HEADERS['resulting_checked_type'] = FormHeader(_("Sheet"))
+ resulting_checked_type = forms.ChoiceField(label=_("Check"),
required=False)
resulting_check_date = forms.DateField(
- initial=get_now, label=_(u"Check date"), widget=DatePicker)
+ initial=get_now, label=_("Check date"), widget=DatePicker)
TYPES = [
FieldType('resulting_material_type', models.MaterialType,
@@ -526,26 +526,26 @@ class ResultingFindForm(CustomForm, ManageOldType):
class ResultingFindsForm(CustomForm, ManageOldType):
form_label = _("Resulting finds")
- form_admin_name = _(u"Treatment 1-n - 030 - Resulting finds")
+ form_admin_name = _("Treatment 1-n - 030 - Resulting finds")
form_slug = "treatment1n-030-resulting-finds"
associated_models = {}
resultings_number = forms.IntegerField(
- label=_(u"Number of resulting finds"),
+ label=_("Number of resulting finds"),
min_value=1
)
resultings_label = forms.CharField(
- label=_(u"Prefix label for resulting finds"),
+ label=_("Prefix label for resulting finds"),
validators=[validators.MaxLengthValidator(200)],
help_text=_(
'E.g.: with a prefix "item-", each resulting item will be named '
'"item-1", "item-2", "item-3"')
)
resultings_start_number = forms.IntegerField(
- label=_(u"Numbering starting from"), initial=1, min_value=0
+ label=_("Numbering starting from"), initial=1, min_value=0
)
resultings_basket_name = forms.CharField(
- label=_(u"Name of the new basket containing the resulting items"),
+ label=_("Name of the new basket containing the resulting items"),
max_length=200
)
@@ -563,13 +563,13 @@ class ResultingFindsForm(CustomForm, ManageOldType):
q = models.FindBasket.objects.filter(
user=self.user, label=self.cleaned_data['resultings_basket_name'])
if q.count():
- raise forms.ValidationError(_(u"A basket with this label already "
- u"exists."))
+ raise forms.ValidationError(_("A basket with this label already "
+ "exists."))
return self.cleaned_data
class QAFindFormMulti(QAForm):
- form_admin_name = _(u"Find - Quick action - Modify")
+ form_admin_name = _("Find - Quick action - Modify")
form_slug = "find-quickaction-modify"
base_models = ['get_first_base_find', 'qa_object_types',
'qa_material_types', 'qa_communicabilities',
@@ -614,17 +614,17 @@ class QAFindFormMulti(QAForm):
validators=[valid_id(ContextRecord)], required=False)
qa_label = forms.CharField(
- label=_(u"Free ID"),
+ label=_("Free ID"),
validators=[validators.MaxLengthValidator(60)], required=False)
- qa_denomination = forms.CharField(label=_(u"Denomination"), required=False)
+ qa_denomination = forms.CharField(label=_("Denomination"), required=False)
qa_previous_id = forms.CharField(label=_("Previous ID"), required=False)
qa_get_first_base_find__excavation_id = forms.CharField(
- label=_(u"Excavation ID"), required=False)
- qa_museum_id = forms.CharField(label=_(u"Museum ID"), required=False)
- qa_laboratory_id = forms.CharField(label=_(u"Laboratory ID"),
+ label=_("Excavation ID"), required=False)
+ qa_museum_id = forms.CharField(label=_("Museum ID"), required=False)
+ qa_laboratory_id = forms.CharField(label=_("Laboratory ID"),
required=False)
- qa_seal_number = forms.CharField(label=_(u"Seal number"), required=False)
- qa_mark = forms.CharField(label=_(u"Mark"), required=False)
+ qa_seal_number = forms.CharField(label=_("Seal number"), required=False)
+ qa_mark = forms.CharField(label=_("Mark"), required=False)
#qa_collection = forms.IntegerField(
# label=_("Collection"),
# widget=widgets.JQueryAutoComplete(
@@ -633,42 +633,42 @@ class QAFindFormMulti(QAForm):
# validators=[valid_id(Warehouse)], required=False)
qa_description = forms.CharField(
- label=_(u"Description"), widget=forms.Textarea, required=False)
+ label=_("Description"), widget=forms.Textarea, required=False)
qa_material_types = widgets.Select2MultipleField(
- label=_(u"Material types"), required=False
+ label=_("Material types"), required=False
)
qa_object_types = widgets.Select2MultipleField(
- label=_(u"Object types"), required=False,
+ label=_("Object types"), required=False,
)
qa_manufacturing_place = forms.CharField(
- label=_(u"Manufacturing place"), required=False)
+ label=_("Manufacturing place"), required=False)
qa_communicabilities = widgets.Select2MultipleField(
- label=_(u"Communicability"), required=False
+ label=_("Communicability"), required=False
)
qa_alterations = widgets.Select2MultipleField(
- label=_(u"Alteration"), required=False
+ label=_("Alteration"), required=False
)
qa_alteration_causes = widgets.Select2MultipleField(
- label=_(u"Alteration cause"), required=False
+ label=_("Alteration cause"), required=False
)
qa_conservatory_state = forms.ChoiceField(label=_("Conservatory state"),
required=False, choices=[])
qa_treatment_emergency = forms.ChoiceField(label=_("Treatment emergency"),
choices=[], required=False)
qa_comment = forms.CharField(
- label=_(u"Comment"), required=False,
+ label=_("Comment"), required=False,
widget=forms.Textarea)
- qa_checked_type = forms.ChoiceField(label=_(u"Check"), required=False)
+ qa_checked_type = forms.ChoiceField(label=_("Check"), required=False)
qa_check_date = forms.DateField(
- label=_(u"Check date"), widget=DatePicker, required=False)
+ label=_("Check date"), widget=DatePicker, required=False)
qa_appraisal_date = forms.DateField(
label=_("Appraisal date"), widget=DatePicker, required=False)
qa_period = widgets.Select2MultipleField(
label=_("Period"), choices=[], required=False)
qa_dating_comment = forms.CharField(
- label=_(u"Comment on dating"), required=False,
+ label=_("Comment on dating"), required=False,
widget=forms.Textarea)
TYPES = [
@@ -722,7 +722,7 @@ class QAFindFormMulti(QAForm):
class QAFindFormSingle(QAFindFormMulti):
MULTI = False
- form_admin_name = _(u"Find - Quick action - Modify single")
+ form_admin_name = _("Find - Quick action - Modify single")
form_slug = "find-quickaction-modifysingle"
def __init__(self, *args, **kwargs):
@@ -759,7 +759,7 @@ class QAFindBasketForm(IshtarForm):
if self.cleaned_data['qa_bf_create_or_update'] == 'update':
if not self.cleaned_data['qa_bf_basket']:
raise forms.ValidationError(
- _(u"On update, you have to select a basket."))
+ _("On update, you have to select a basket."))
q = Q(user=self.user) | Q(shared_write_with__pk=self.user.pk)
q = models.FindBasket.objects.filter(q).filter(
pk=self.cleaned_data['qa_bf_basket'])
@@ -769,11 +769,11 @@ class QAFindBasketForm(IshtarForm):
return self.cleaned_data
label = self.cleaned_data['qa_bf_label'].strip()
if not label:
- raise forms.ValidationError(_(u"A label is required."))
+ raise forms.ValidationError(_("A label is required."))
if models.FindBasket.objects.filter(user=self.user,
label=label).count():
- raise forms.ValidationError(_(u"A basket with this label already "
- u"exists."))
+ raise forms.ValidationError(_("A basket with this label already "
+ "exists."))
return self.cleaned_data
def save(self, items):
@@ -826,16 +826,16 @@ class QAFindbasketDuplicateForm(IshtarForm):
self.basket = kwargs.pop('items')[0]
super(QAFindbasketDuplicateForm, self).__init__(*args, **kwargs)
self.fields['label'].initial = self.basket.label + str(
- _(u" - duplicate"))
+ _(" - duplicate"))
def clean(self):
label = self.cleaned_data['label'].strip()
if not label:
- raise forms.ValidationError(_(u"A label is required."))
+ raise forms.ValidationError(_("A label is required."))
if models.FindBasket.objects.filter(user=self.user,
label=label).count():
- raise forms.ValidationError(_(u"A basket with this label already "
- u"exists."))
+ raise forms.ValidationError(_("A basket with this label already "
+ "exists."))
return self.cleaned_data
def save(self):
@@ -845,7 +845,7 @@ class QAFindbasketDuplicateForm(IshtarForm):
class PreservationForm(CustomForm, ManageOldType):
form_label = _("Preservation")
- form_admin_name = _(u"Find - 030 - Preservation")
+ form_admin_name = _("Find - 030 - Preservation")
form_slug = "find-030-preservation"
base_models = ['alteration', 'alteration_cause',
'preservation_to_consider', 'integritie', 'remarkabilitie']
@@ -859,30 +859,30 @@ class PreservationForm(CustomForm, ManageOldType):
'integritie': models.IntegrityType,
}
integritie = forms.MultipleChoiceField(
- label=_(u"Integrity / interest"), choices=[],
+ label=_("Integrity / interest"), choices=[],
widget=widgets.Select2Multiple, required=False)
remarkabilitie = forms.MultipleChoiceField(
- label=_(u"Remarkability"), choices=[],
+ label=_("Remarkability"), choices=[],
widget=widgets.Select2Multiple, required=False)
- conservatory_state = forms.ChoiceField(label=_(u"Conservatory state"),
+ conservatory_state = forms.ChoiceField(label=_("Conservatory state"),
choices=[], required=False)
alteration = forms.MultipleChoiceField(
- label=_(u"Alteration"), choices=[],
+ label=_("Alteration"), choices=[],
widget=widgets.Select2Multiple, required=False)
alteration_cause = forms.MultipleChoiceField(
- label=_(u"Alteration cause"), choices=[],
+ label=_("Alteration cause"), choices=[],
widget=widgets.Select2Multiple, required=False)
preservation_to_consider = forms.MultipleChoiceField(
label=_("Recommended treatments"), choices=[],
widget=widgets.Select2Multiple, required=False)
treatment_emergency = forms.ChoiceField(label=_("Treatment emergency"),
choices=[], required=False)
- estimated_value = FloatField(label=_(u"Estimated value"), required=False)
- insurance_value = FloatField(label=_(u"Insurance value"), required=False)
+ estimated_value = FloatField(label=_("Estimated value"), required=False)
+ insurance_value = FloatField(label=_("Insurance value"), required=False)
appraisal_date = forms.DateField(
- label=_(u"Appraisal date"), widget=DatePicker, required=False)
+ label=_("Appraisal date"), widget=DatePicker, required=False)
conservatory_comment = forms.CharField(
- label=_(u"Conservatory comment"), required=False,
+ label=_("Conservatory comment"), required=False,
widget=forms.Textarea)
TYPES = [
@@ -914,9 +914,9 @@ class DateForm(ManageOldType, forms.Form):
'quality': DatingQuality,
'period': Period}
period = forms.ChoiceField(label=_("Period"), choices=[])
- start_date = forms.IntegerField(label=_(u"Start date"),
+ start_date = forms.IntegerField(label=_("Start date"),
required=False)
- end_date = forms.IntegerField(label=_(u"End date"), required=False)
+ end_date = forms.IntegerField(label=_("End date"), required=False)
quality = forms.ChoiceField(label=_("Quality"), required=False,
choices=[])
dating_type = forms.ChoiceField(label=_("Dating type"),
@@ -933,7 +933,7 @@ class DateForm(ManageOldType, forms.Form):
DatingFormSet = formset_factory(DateForm, can_delete=True,
formset=FormSet)
DatingFormSet.form_label = _("Dating")
-DatingFormSet.form_admin_name = _(u"Find - 040 - Dating")
+DatingFormSet.form_admin_name = _("Find - 040 - Dating")
DatingFormSet.form_slug = "find-040-dating"
@@ -985,37 +985,37 @@ class FindSelect(DocumentItemSelect, PeriodSelect):
]
search_vector = forms.CharField(
- label=_(u"Full text search"), widget=widgets.SearchWidget(
+ label=_("Full text search"), widget=widgets.SearchWidget(
'archaeological-finds', 'find'
))
- label = forms.CharField(label=_(u"Free ID"))
- denomination = forms.CharField(label=_(u"Denomination"))
- previous_id = forms.CharField(label=_(u"Previous ID"))
- base_finds__excavation_id = forms.CharField(label=_(u"Excavation ID"))
- seal_number = forms.CharField(label=_(u"Seal number"))
- museum_id = forms.CharField(label=_(u"Museum ID"))
- laboratory_id = forms.CharField(label=_(u"Laboratory ID"))
- mark = forms.CharField(label=_(u"Mark"))
+ label = forms.CharField(label=_("Free ID"))
+ denomination = forms.CharField(label=_("Denomination"))
+ previous_id = forms.CharField(label=_("Previous ID"))
+ base_finds__excavation_id = forms.CharField(label=_("Excavation ID"))
+ seal_number = forms.CharField(label=_("Seal number"))
+ museum_id = forms.CharField(label=_("Museum ID"))
+ laboratory_id = forms.CharField(label=_("Laboratory ID"))
+ mark = forms.CharField(label=_("Mark"))
base_finds__cache_short_id = forms.CharField(
- label=_(u"Base find - Short ID"))
+ label=_("Base find - Short ID"))
base_finds__cache_complete_id = forms.CharField(
- label=_(u"Base find - Complete ID"))
+ label=_("Base find - Complete ID"))
base_finds__context_record__town = get_town_field()
base_finds__context_record__operation__year = forms.IntegerField(
- label=_(u"Year"))
+ label=_("Year"))
base_finds__context_record__operation__operation_code = forms.IntegerField(
- label=_(u"Operation's number (index by year)"))
+ label=_("Operation's number (index by year)"))
base_finds__context_record__operation__code_patriarche = \
forms.IntegerField(
- label=_(u"Code PATRIARCHE"),
+ label=_("Code PATRIARCHE"),
widget=OAWidget
)
base_finds__context_record__operation__operation_type = forms.ChoiceField(
- label=_(u"Operation type"), choices=[]
+ label=_("Operation type"), choices=[]
)
base_finds__context_record__town__areas = forms.ChoiceField(
- label=_(u"Areas"), choices=[]
+ label=_("Areas"), choices=[]
)
archaeological_sites = forms.IntegerField(
label=_("Archaeological site (attached to the operation)"),
@@ -1024,7 +1024,7 @@ class FindSelect(DocumentItemSelect, PeriodSelect):
associated_model=ArchaeologicalSite),
validators=[valid_id(ArchaeologicalSite)])
archaeological_sites_name = forms.CharField(
- label=_(u"Archaeological site name (attached to the operation)")
+ label=_("Archaeological site name (attached to the operation)")
)
archaeological_sites_context_record = forms.IntegerField(
label=_("Archaeological site (attached to the context record)"),
@@ -1033,7 +1033,7 @@ class FindSelect(DocumentItemSelect, PeriodSelect):
associated_model=ArchaeologicalSite),
validators=[valid_id(ArchaeologicalSite)])
archaeological_sites_context_record_name = forms.CharField(
- label=_(u"Archaeological site name (attached to the context record)")
+ label=_("Archaeological site name (attached to the context record)")
)
base_finds__context_record = forms.IntegerField(
label=_("Context record"),
@@ -1042,40 +1042,40 @@ class FindSelect(DocumentItemSelect, PeriodSelect):
associated_model=ContextRecord),
validators=[valid_id(ContextRecord)])
ope_relation_types = forms.ChoiceField(
- label=_(u"Search within related operations"), choices=[])
+ label=_("Search within related operations"), choices=[])
cr_relation_types = forms.ChoiceField(
- label=_(u"Search within related context records"), choices=[])
+ label=_("Search within related context records"), choices=[])
basket = forms.IntegerField(
- label=_(u"Basket"),
+ label=_("Basket"),
widget=widgets.JQueryAutoComplete(
reverse_lazy('autocomplete-findbasket'),
associated_model=models.FindBasket),
validators=[valid_id(models.FindBasket)])
- description = forms.CharField(label=_(u"Description"))
+ description = forms.CharField(label=_("Description"))
base_finds__discovery_date__after = forms.DateField(
- label=_(u"Discovery date after"), widget=DatePicker
+ label=_("Discovery date after"), widget=DatePicker
)
base_finds__discovery_date__before = forms.DateField(
- label=_(u"Discovery date before"), widget=DatePicker
+ label=_("Discovery date before"), widget=DatePicker
)
base_finds__discovery_date_tpq__after = forms.DateField(
- label=_(u"Discovery date (exact or TPQ) after"), widget=DatePicker
+ label=_("Discovery date (exact or TPQ) after"), widget=DatePicker
)
base_finds__discovery_date_tpq__before = forms.DateField(
- label=_(u"Discovery date (exact or TPQ) before"), widget=DatePicker
+ label=_("Discovery date (exact or TPQ) before"), widget=DatePicker
)
base_finds__discovery_date_taq__after = forms.DateField(
- label=_(u"Discovery date (TAQ) after"), widget=DatePicker
+ label=_("Discovery date (TAQ) after"), widget=DatePicker
)
base_finds__discovery_date_taq__before = forms.DateField(
- label=_(u"Discovery date (TAQ) before"), widget=DatePicker
+ label=_("Discovery date (TAQ) before"), widget=DatePicker
)
- base_finds__batch = forms.ChoiceField(label=_(u"Batch/object"), choices=[])
- is_complete = forms.NullBooleanField(label=_(u"Is complete?"))
+ base_finds__batch = forms.ChoiceField(label=_("Batch/object"), choices=[])
+ is_complete = forms.NullBooleanField(label=_("Is complete?"))
material_types = forms.IntegerField(
- label=_(u"Material type"),
+ label=_("Material type"),
widget=widgets.JQueryAutoComplete(
reverse_lazy('autocomplete-materialtype'),
associated_model=models.MaterialType),
@@ -1084,113 +1084,113 @@ class FindSelect(DocumentItemSelect, PeriodSelect):
choices=[])
material_comment = forms.CharField(label=_("Comment on the material"))
object_types = forms.IntegerField(
- label=_(u"Object type"),
+ label=_("Object type"),
widget=widgets.JQueryAutoComplete(
reverse_lazy('autocomplete-objecttype'),
associated_model=models.ObjectType),
)
object_type_quality = forms.ChoiceField(
- label=_(u"Object type quality"), choices=[])
+ label=_("Object type quality"), choices=[])
- find_number = forms.IntegerField(label=_(u"Find number"))
+ find_number = forms.IntegerField(label=_("Find number"))
min_number_of_individuals = forms.IntegerField(
- label=_(u"Minimum number of individuals (MNI)"))
+ label=_("Minimum number of individuals (MNI)"))
- manufacturing_place = forms.CharField(label=_(u"Manufacturing place"))
- decoration = forms.CharField(label=_(u"Decoration"))
- inscription = forms.CharField(label=_(u"Inscription"))
+ manufacturing_place = forms.CharField(label=_("Manufacturing place"))
+ decoration = forms.CharField(label=_("Decoration"))
+ inscription = forms.CharField(label=_("Inscription"))
- communicabilities = forms.ChoiceField(label=_(u"Communicability"))
- comment = forms.CharField(label=_(u"Comment"))
+ communicabilities = forms.ChoiceField(label=_("Communicability"))
+ comment = forms.CharField(label=_("Comment"))
cultural_attributions = forms.ChoiceField(
label=_("Cultural attribution"), choices=[], required=False)
- dating_comment = forms.CharField(label=_(u"Comment on dating"))
+ dating_comment = forms.CharField(label=_("Comment on dating"))
- length__higher = FloatField(label=_(u"Length - higher than (cm)"),
+ length__higher = FloatField(label=_("Length - higher than (cm)"),
widget=widgets.CentimeterMeterWidget)
- length__lower = FloatField(label=_(u"Length - lower than (cm)"),
+ length__lower = FloatField(label=_("Length - lower than (cm)"),
widget=widgets.CentimeterMeterWidget)
width__lower = FloatField(
- label=_(u"Width - lower than (cm)"),
+ label=_("Width - lower than (cm)"),
widget=widgets.CentimeterMeterWidget)
width__higher = FloatField(
- label=_(u"Width - higher than (cm)"),
+ label=_("Width - higher than (cm)"),
widget=widgets.CentimeterMeterWidget)
height__lower = FloatField(
- label=_(u"Height - lower than (cm)"),
+ label=_("Height - lower than (cm)"),
widget=widgets.CentimeterMeterWidget)
height__higher = FloatField(
- label=_(u"Height - higher than (cm)"),
+ label=_("Height - higher than (cm)"),
widget=widgets.CentimeterMeterWidget)
thickness__lower = FloatField(
- label=_(u"Thickness - lower than (cm)"),
+ label=_("Thickness - lower than (cm)"),
widget=widgets.CentimeterMeterWidget)
thickness__higher = FloatField(
- label=_(u"Thickness - higher than (cm)"),
+ label=_("Thickness - higher than (cm)"),
widget=widgets.CentimeterMeterWidget)
diameter__lower = FloatField(
- label=_(u"Diameter - lower than (cm)"),
+ label=_("Diameter - lower than (cm)"),
widget=widgets.CentimeterMeterWidget)
diameter__higher = FloatField(
- label=_(u"Diameter - higher than (cm)"),
+ label=_("Diameter - higher than (cm)"),
widget=widgets.CentimeterMeterWidget)
circumference__lower = FloatField(
- label=_(u"Circumference - lower than (cm)"),
+ label=_("Circumference - lower than (cm)"),
widget=widgets.CentimeterMeterWidget)
circumference__higher = FloatField(
- label=_(u"Circumference - higher than (cm)"),
+ label=_("Circumference - higher than (cm)"),
widget=widgets.CentimeterMeterWidget)
- volume__lower = FloatField(label=_(u"Volume - lower than (l)"))
- volume__higher = FloatField(label=_(u"Volume - higher than (l)"))
+ volume__lower = FloatField(label=_("Volume - lower than (l)"))
+ volume__higher = FloatField(label=_("Volume - higher than (l)"))
weight__lower = FloatField(
- label=_(u"Weight - lower than (g)"),
+ label=_("Weight - lower than (g)"),
widget=widgets.GramKilogramWidget)
weight__higher = FloatField(
- label=_(u"Weight - higher than (g)"),
+ label=_("Weight - higher than (g)"),
widget=widgets.GramKilogramWidget)
clutter_long_side__lower = FloatField(
- label=_(u"Clutter long side - lower than (cm)"),
+ label=_("Clutter long side - lower than (cm)"),
widget=widgets.CentimeterMeterWidget)
clutter_long_side__higher = FloatField(
- label=_(u"Clutter long side - higher than (cm)"),
+ label=_("Clutter long side - higher than (cm)"),
widget=widgets.CentimeterMeterWidget)
clutter_short_side__lower = FloatField(
- label=_(u"Clutter short side - lower than (cm)"),
+ label=_("Clutter short side - lower than (cm)"),
widget=widgets.CentimeterMeterWidget)
clutter_short_side__higher = FloatField(
- label=_(u"Clutter short side - higher than (cm)"),
+ label=_("Clutter short side - higher than (cm)"),
widget=widgets.CentimeterMeterWidget)
clutter_height__lower = FloatField(
- label=_(u"Clutter height - lower than (cm)"),
+ label=_("Clutter height - lower than (cm)"),
widget=widgets.CentimeterMeterWidget)
clutter_height__higher = FloatField(
- label=_(u"Clutter height - higher than (cm)"),
+ label=_("Clutter height - higher than (cm)"),
widget=widgets.CentimeterMeterWidget)
dimensions_comment = forms.CharField(
- label=_(u"Dimensions comment"))
+ label=_("Dimensions comment"))
base_finds__topographic_localisation = forms.CharField(
- label=_(u"Point of topographic reference"),
+ label=_("Point of topographic reference"),
)
checked_type = forms.ChoiceField(label=_("Check"))
check_date__after = forms.DateField(
- label=_(u"Check date after"), widget=DatePicker
+ label=_("Check date after"), widget=DatePicker
)
check_date__before = forms.DateField(
- label=_(u"Check date before"), widget=DatePicker
+ label=_("Check date before"), widget=DatePicker
)
- integrities = forms.ChoiceField(label=_(u"Integrity / interest"),
+ integrities = forms.ChoiceField(label=_("Integrity / interest"),
choices=[])
- remarkabilities = forms.ChoiceField(label=_(u"Remarkability"),
+ remarkabilities = forms.ChoiceField(label=_("Remarkability"),
choices=[])
- conservatory_state = forms.ChoiceField(label=_(u"Conservatory state"),
+ conservatory_state = forms.ChoiceField(label=_("Conservatory state"),
choices=[])
conservatory_comment = forms.CharField(label=_("Conservatory comment"))
alterations = forms.ChoiceField(
- label=_(u"Alteration"), choices=[])
+ label=_("Alteration"), choices=[])
alteration_causes = forms.ChoiceField(
- label=_(u"Alteration cause"), choices=[])
+ label=_("Alteration cause"), choices=[])
preservation_to_considers = forms.ChoiceField(
choices=[], label=_("Recommended treatments"))
treatment_emergency = forms.ChoiceField(
@@ -1198,19 +1198,19 @@ class FindSelect(DocumentItemSelect, PeriodSelect):
)
estimated_value__higher = FloatField(
- label=_(u"Estimated value - higher than"))
+ label=_("Estimated value - higher than"))
estimated_value__lower = FloatField(
- label=_(u"Estimated value - lower than"))
+ label=_("Estimated value - lower than"))
insurance_value__higher = FloatField(
- label=_(u"Insurance value - higher than"))
+ label=_("Insurance value - higher than"))
insurance_value__lower = FloatField(
- label=_(u"Insurance value - lower than"))
+ label=_("Insurance value - lower than"))
appraisal_date__after = forms.DateField(
- label=_(u"Appraisal date after"), widget=DatePicker)
+ label=_("Appraisal date after"), widget=DatePicker)
appraisal_date__before = forms.DateField(
- label=_(u"Appraisal date before"), widget=DatePicker)
+ label=_("Appraisal date before"), widget=DatePicker)
- loan = forms.NullBooleanField(label=_(u"Loan?"))
+ loan = forms.NullBooleanField(label=_("Loan?"))
treatments_file_end_date = forms.DateField(
label=_("Treatment file end date before"), widget=DatePicker
)
@@ -1293,9 +1293,9 @@ class FindSelectWarehouseModule(FindSelect):
associated_model=Warehouse),
validators=[valid_id(Warehouse)])
container_ref__index = forms.IntegerField(
- label=_(u"Reference container ID"))
+ label=_("Reference container ID"))
container_ref__reference = forms.CharField(
- label=_(u"Reference container ref."))
+ label=_("Reference container ref."))
"""
container = forms.IntegerField(
label=_("Current container"),
@@ -1311,13 +1311,13 @@ class FindSelectWarehouseModule(FindSelect):
validators=[valid_id(Warehouse)])
"""
container__responsible = forms.IntegerField(
- label=_(u"Current container - Warehouse (responsible)"),
+ label=_("Current container - Warehouse (responsible)"),
widget=widgets.JQueryAutoComplete(
reverse_lazy('autocomplete-warehouse'),
associated_model=Warehouse),
validators=[valid_id(Warehouse)])
- container__index = forms.IntegerField(label=_(u"Current container ID"))
- container__reference = forms.CharField(label=_(u"Current container ref."))
+ container__index = forms.IntegerField(label=_("Current container ID"))
+ container__reference = forms.CharField(label=_("Current container ref."))
"""
@@ -1410,9 +1410,9 @@ class MultipleFindFormSelectionWarehouseModule(MultipleFindFormSelection):
class FindMultipleFormSelection(forms.Form):
- form_label = _(u"Upstream finds")
+ form_label = _("Upstream finds")
associated_models = {'finds': models.Find}
- associated_labels = {'finds': _(u"Finds")}
+ associated_labels = {'finds': _("Finds")}
# using FindSelectWarehouseModule because this form is only used with
# the warehouse module activated
finds = forms.CharField(
@@ -1425,8 +1425,8 @@ class FindMultipleFormSelection(forms.Form):
def clean(self):
if 'finds' not in self.cleaned_data or not self.cleaned_data['finds']:
- raise forms.ValidationError(_(u"You should at least select one "
- u"archaeological find."))
+ raise forms.ValidationError(_("You should at least select one "
+ "archaeological find."))
return self.cleaned_data
@@ -1528,17 +1528,17 @@ def check_treatment(form_name, type_key, type_list=[], not_type_list=[]):
class ResultFindForm(ManageOldType, forms.Form):
- form_label = _(u"Resulting find")
+ form_label = _("Resulting find")
associated_models = {'material_type': models.MaterialType}
label = forms.CharField(
- label=_(u"Free ID"),
+ label=_("Free ID"),
validators=[validators.MaxLengthValidator(60)])
- description = forms.CharField(label=_(u"Precise description"),
+ description = forms.CharField(label=_("Precise description"),
widget=forms.Textarea)
- material_type = forms.ChoiceField(label=_(u"Material type"), choices=[])
- volume = forms.IntegerField(label=_(u"Volume (l)"))
- weight = forms.IntegerField(label=_(u"Weight (g)"))
- find_number = forms.IntegerField(label=_(u"Find number"))
+ material_type = forms.ChoiceField(label=_("Material type"), choices=[])
+ volume = forms.IntegerField(label=_("Volume (l)"))
+ weight = forms.IntegerField(label=_("Weight (g)"))
+ find_number = forms.IntegerField(label=_("Find number"))
TYPES = [
FieldType('material_type', models.MaterialType)
@@ -1547,16 +1547,16 @@ class ResultFindForm(ManageOldType, forms.Form):
ResultFindFormSet = formset_factory(ResultFindForm, can_delete=True,
formset=FormSet)
-ResultFindFormSet.form_label = _(u"Resulting finds")
+ResultFindFormSet.form_label = _("Resulting finds")
class FindDeletionForm(FinalForm):
confirm_msg = " "
- confirm_end_msg = _(u"Would you like to delete this find?")
+ confirm_end_msg = _("Would you like to delete this find?")
class UpstreamFindFormSelection(MultiSearchForm, FindFormSelection):
- form_label = _(u"Upstream finds")
+ form_label = _("Upstream finds")
current_model = models.Find
pk_key = 'resulting_pk'
associated_models = {"resulting_pk": models.Find}
@@ -1587,14 +1587,14 @@ class SingleUpstreamFindFormSelection(UpstreamFindFormSelection):
class FindBasketSelect(CustomForm, TableSelect):
_model = models.FindBasket
- form_admin_name = _(u"Find basket - 001 - Search")
+ form_admin_name = _("Find basket - 001 - Search")
form_slug = "findbasket-001-search"
search_vector = forms.CharField(
- label=_(u"Full text search"), widget=widgets.SearchWidget(
+ label=_("Full text search"), widget=widgets.SearchWidget(
'archaeological-finds', 'findbasket'
))
- label = forms.CharField(label=_(u"Denomination"))
+ label = forms.CharField(label=_("Denomination"))
class FindBasketFormSelection(CustomFormSearch):
@@ -1628,24 +1628,24 @@ class FindBasketForWriteFormSelection(CustomFormSearch):
class FindBasketForm(IshtarForm):
- form_label = _(u"Find basket")
+ form_label = _("Find basket")
associated_models = {"shared_with": IshtarUser,
"shared_write_with": IshtarUser}
label = forms.CharField(
- label=_(u"Label"),
+ label=_("Label"),
validators=[validators.MaxLengthValidator(1000)])
slug = forms.SlugField(label=_("Slug"), required=False)
public = forms.BooleanField(label=_("Is public"), required=False)
- comment = forms.CharField(label=_(u"Comment"),
+ comment = forms.CharField(label=_("Comment"),
widget=forms.Textarea, required=False)
shared_with = widgets.Select2MultipleField(
model=IshtarUser, remote=True,
- label=_(u"Shared (read) with"),
+ label=_("Shared (read) with"),
required=False, long_widget=True
)
shared_write_with = widgets.Select2MultipleField(
model=IshtarUser, remote=True,
- label=_(u"Shared (read/edit) with"),
+ label=_("Shared (read/edit) with"),
required=False, long_widget=True
)
@@ -1674,12 +1674,12 @@ class FindBasketForm(IshtarForm):
class NewFindBasketForm(forms.ModelForm, IshtarForm):
shared_with = widgets.Select2MultipleField(
model=IshtarUser, remote=True,
- label=_(u"Shared (read) with"),
+ label=_("Shared (read) with"),
required=False, long_widget=True
)
shared_write_with = widgets.Select2MultipleField(
model=IshtarUser, remote=True,
- label=_(u"Shared (read/edit) with"),
+ label=_("Shared (read/edit) with"),
required=False, long_widget=True
)
@@ -1702,8 +1702,8 @@ class NewFindBasketForm(forms.ModelForm, IshtarForm):
q = models.FindBasket.objects.filter(user=self.user,
label=self.cleaned_data['label'])
if q.count():
- raise forms.ValidationError(_(u"Another basket already exists with "
- u"this name."))
+ raise forms.ValidationError(_("Another basket already exists with "
+ "this name."))
slug = self.cleaned_data.get('slug', None)
if slug and slug.strip() and models.FindBasket.objects.filter(
slug=slug.strip()).count():
@@ -1717,12 +1717,12 @@ class NewFindBasketForm(forms.ModelForm, IshtarForm):
class SelectFindBasketForm(IshtarForm):
- form_label = _(u"Basket")
+ form_label = _("Basket")
associated_models = {'basket': models.FindBasket}
need_user_for_initialization = True
basket = forms.IntegerField(
- label=_(u"Basket"),
+ label=_("Basket"),
widget=widgets.JQueryAutoComplete(
reverse_lazy('autocomplete-findbasket'),
associated_model=models.FindBasket),
@@ -1738,12 +1738,12 @@ class SelectFindBasketForm(IshtarForm):
class SelectFindBasketWriteForm(IshtarForm):
- form_label = _(u"Basket")
+ form_label = _("Basket")
associated_models = {'basket': models.FindBasket}
need_user_for_initialization = True
basket = forms.IntegerField(
- label=_(u"Basket"),
+ label=_("Basket"),
widget=widgets.JQueryAutoComplete(
reverse_lazy('autocomplete-findbasket-write'),
associated_model=models.FindBasket),
diff --git a/archaeological_finds/forms_treatments.py b/archaeological_finds/forms_treatments.py
index ac4420ce8..7fc0d877c 100644
--- a/archaeological_finds/forms_treatments.py
+++ b/archaeological_finds/forms_treatments.py
@@ -45,24 +45,24 @@ logger = logging.getLogger(__name__)
class TreatmentSelect(DocumentItemSelect):
_model = models.Treatment
- form_admin_name = _(u"Treatment - 001 - Search")
+ form_admin_name = _("Treatment - 001 - Search")
form_slug = "treatment-001-search"
search_vector = forms.CharField(
- label=_(u"Full text search"), widget=widgets.SearchWidget(
+ label=_("Full text search"), widget=widgets.SearchWidget(
'archaeological-finds', 'treatment'
))
- label = forms.CharField(label=_(u"Label"))
- other_reference = forms.CharField(label=_(u"Other ref."))
- year = forms.IntegerField(label=_(u"Year"))
- index = forms.IntegerField(label=_(u"Index"))
+ label = forms.CharField(label=_("Label"))
+ other_reference = forms.CharField(label=_("Other ref."))
+ year = forms.IntegerField(label=_("Year"))
+ index = forms.IntegerField(label=_("Index"))
scientific_monitoring_manager = forms.IntegerField(
widget=widgets.JQueryAutoComplete(
reverse_lazy('autocomplete-person-permissive'),
associated_model=Person),
- label=_(u"Scientific monitoring manager"))
- treatment_types = forms.ChoiceField(label=_(u"Treatment type"), choices=[])
+ label=_("Scientific monitoring manager"))
+ treatment_types = forms.ChoiceField(label=_("Treatment type"), choices=[])
def __init__(self, *args, **kwargs):
super(TreatmentSelect, self).__init__(*args, **kwargs)
@@ -123,8 +123,8 @@ class TreatmentStateSelect(forms.Select):
class BaseTreatmentForm(CustomForm, ManageOldType):
UPSTREAM_IS_MANY = False
DOWNSTREAM_IS_MANY = False
- form_label = _(u"Treatment")
- form_admin_name = _(u"Treatment - 020 - General")
+ form_label = _("Treatment")
+ form_admin_name = _("Treatment - 020 - General")
form_slug = "treatment-020-general"
base_models = ['treatment_type']
extra_form_modals = ["container", "warehouse", "organization", "person"]
@@ -140,16 +140,16 @@ class BaseTreatmentForm(CustomForm, ManageOldType):
need_user_for_initialization = True
treatment_type = widgets.Select2MultipleField(
- label=_(u"Treatment type"), choices=[],
+ label=_("Treatment type"), choices=[],
widget=widgets.CheckboxSelectMultiple)
- treatment_state = forms.ChoiceField(label=_(u"State"), choices=[],
+ treatment_state = forms.ChoiceField(label=_("State"), choices=[],
widget=TreatmentStateSelect)
year = forms.IntegerField(label=_("Year"),
initial=lambda: datetime.datetime.now().year,
validators=[validators.MinValueValidator(1000),
validators.MaxValueValidator(2100)])
location = forms.IntegerField(
- label=_(u"Location"),
+ label=_("Location"),
widget=widgets.JQueryAutoComplete(
reverse_lazy('autocomplete-warehouse'), associated_model=Warehouse,
new=True),
@@ -161,47 +161,47 @@ class BaseTreatmentForm(CustomForm, ManageOldType):
new=True),
validators=[valid_id(Person)], required=False)
person = forms.IntegerField(
- label=_(u"Responsible"),
+ label=_("Responsible"),
widget=widgets.JQueryAutoComplete(
reverse_lazy('autocomplete-person'), associated_model=Person,
new=True),
validators=[valid_id(Person)], required=False)
organization = forms.IntegerField(
- label=_(u"Organization"),
+ label=_("Organization"),
widget=widgets.JQueryAutoComplete(
reverse_lazy('autocomplete-organization'),
associated_model=Organization, new=True),
validators=[valid_id(Organization)], required=False)
- label = forms.CharField(label=_(u"Label"),
+ label = forms.CharField(label=_("Label"),
max_length=200, required=False)
other_reference = forms.CharField(
- label=_(u"Other ref."), max_length=200, required=False)
+ label=_("Other ref."), max_length=200, required=False)
# external_id = forms.CharField(
- # label=_(u"External ref."), max_length=200, required=False)
- start_date = forms.DateField(label=_(u"Start date"), required=False,
+ # label=_("External ref."), max_length=200, required=False)
+ start_date = forms.DateField(label=_("Start date"), required=False,
widget=DatePicker, initial=datetime.date.today)
- end_date = forms.DateField(label=_(u"Closing date"), required=False,
+ end_date = forms.DateField(label=_("Closing date"), required=False,
widget=DatePicker)
container = forms.IntegerField(
- label=_(u"Destination container (relevant for treatment that change "
- u"location)"),
+ label=_("Destination container (relevant for treatment that change "
+ "location)"),
widget=widgets.JQueryAutoComplete(
reverse_lazy('autocomplete-container'),
associated_model=Container, new=True),
validators=[valid_id(Container)], required=False)
- goal = forms.CharField(label=_(u"Goal"),
+ goal = forms.CharField(label=_("Goal"),
widget=forms.Textarea, required=False)
- description = forms.CharField(label=_(u"Description"),
+ description = forms.CharField(label=_("Description"),
widget=forms.Textarea, required=False)
- comment = forms.CharField(label=_(u"Comment"),
+ comment = forms.CharField(label=_("Comment"),
widget=forms.Textarea, required=False)
- estimated_cost = forms.FloatField(label=_(u"Estimated cost ({currency})"),
+ estimated_cost = forms.FloatField(label=_("Estimated cost ({currency})"),
required=False)
- quoted_cost = forms.FloatField(label=_(u"Quoted cost ({currency})"),
+ quoted_cost = forms.FloatField(label=_("Quoted cost ({currency})"),
required=False)
- realized_cost = forms.FloatField(label=_(u"Realized cost ({currency})"),
+ realized_cost = forms.FloatField(label=_("Realized cost ({currency})"),
required=False)
- insurance_cost = forms.FloatField(label=_(u"Insurance cost ({currency})"),
+ insurance_cost = forms.FloatField(label=_("Insurance cost ({currency})"),
required=False)
executed = forms.BooleanField(required=False, disabled=True,
widget=forms.HiddenInput)
@@ -235,12 +235,12 @@ class BaseTreatmentForm(CustomForm, ManageOldType):
person = q.all()[0]
self.fields['scientific_monitoring_manager'].initial = person.pk
# self.fields['target_is_basket'].widget.choices = \
- # ((False, _(u"Single find")), (True, _(u"Basket")))
+ # ((False, _("Single find")), (True, _("Basket")))
# TODO
"""
self.fields['basket'].required = False
self.fields['basket'].help_text = \
- _(u"Leave it blank if you want to select a single item")
+ _("Leave it blank if you want to select a single item")
fields = OrderedDict()
basket = self.fields.pop('basket')
for key, value in self.fields.items():
@@ -261,7 +261,7 @@ class BaseTreatmentForm(CustomForm, ManageOldType):
downstream_is_many=self.DOWNSTREAM_IS_MANY)
for pk in data.get('treatment_type', [])]
except models.TreatmentType.DoesNotExist:
- raise forms.ValidationError(_(u"Unknow treatment type"))
+ raise forms.ValidationError(_("Unknow treatment type"))
change_current_location = [
@@ -282,19 +282,19 @@ class BaseTreatmentForm(CustomForm, ManageOldType):
if change_ref_location:
raise forms.ValidationError(
str(
- _(u"{} is not compatible with {} "
- u"treatment(s).")).format(
- u' ; '.join(restore_reference_location),
- u' ; '.join(change_ref_location),
+ _("{} is not compatible with {} "
+ "treatment(s).")).format(
+ ' ; '.join(restore_reference_location),
+ ' ; '.join(change_ref_location),
)
)
else:
raise forms.ValidationError(
str(
- _(u"{} is not compatible with {} "
- u"treatment(s).")).format(
- u' ; '.join(restore_reference_location),
- u' ; '.join(change_current_location)
+ _("{} is not compatible with {} "
+ "treatment(s).")).format(
+ ' ; '.join(restore_reference_location),
+ ' ; '.join(change_current_location)
)
)
@@ -302,22 +302,22 @@ class BaseTreatmentForm(CustomForm, ManageOldType):
and not change_ref_location\
and not change_current_location:
raise forms.ValidationError(
- _(u"The container field is attached to the treatment but "
- u"no treatment with container change is defined."))
+ _("The container field is attached to the treatment but "
+ "no treatment with container change is defined."))
if not data.get('container', None) and (
change_ref_location or change_current_location):
raise forms.ValidationError(
- _(u"A treatment with location change is defined, the container "
- u"field must be filled."))
+ _("A treatment with location change is defined, the container "
+ "field must be filled."))
if not data.get('person', None) and not data.get('organization', None):
raise forms.ValidationError(
- _(u"A responsible or an organization must be defined."))
+ _("A responsible or an organization must be defined."))
return data
class N1TreatmentForm(BaseTreatmentForm):
UPSTREAM_IS_MANY = True
- form_admin_name = _(u"Treatment n-1 - 020 - General")
+ form_admin_name = _("Treatment n-1 - 020 - General")
form_slug = "treatmentn1-020-general"
TYPES = [
@@ -332,7 +332,7 @@ class N1TreatmentForm(BaseTreatmentForm):
class OneNTreatmentForm(BaseTreatmentForm):
DOWNSTREAM_IS_MANY = True
- form_admin_name = _(u"Treatment 1-n - 020 - General")
+ form_admin_name = _("Treatment 1-n - 020 - General")
form_slug = "treatment1n-020-general"
TYPES = [
@@ -346,7 +346,7 @@ class OneNTreatmentForm(BaseTreatmentForm):
class TreatmentModifyForm(BaseTreatmentForm):
- index = forms.IntegerField(label=_(u"Index"))
+ index = forms.IntegerField(label=_("Index"))
id = forms.IntegerField(label=' ', widget=forms.HiddenInput, required=False)
def __init__(self, *args, **kwargs):
@@ -370,19 +370,19 @@ class TreatmentModifyForm(BaseTreatmentForm):
.filter(year=year, index=index).exclude(pk=pk)
if index and q.count():
raise forms.ValidationError(
- _(u"Another treatment with this index exists for {}."
+ _("Another treatment with this index exists for {}."
).format(year))
return cleaned_data
class TreatmentFormFileChoice(CustomForm, forms.Form):
- form_label = _(u"Associated request")
- form_admin_name = _(u"Treatment - 010 - Request choice")
+ form_label = _("Associated request")
+ form_admin_name = _("Treatment - 010 - Request choice")
form_slug = "treatment-010-requestchoice"
associated_models = {'file': models.TreatmentFile, }
currents = {'file': models.TreatmentFile}
file = forms.IntegerField(
- label=_(u"Treatment request"),
+ label=_("Treatment request"),
widget=widgets.JQueryAutoComplete(
reverse_lazy('autocomplete-treatmentfile'),
associated_model=models.TreatmentFile),
@@ -391,10 +391,10 @@ class TreatmentFormFileChoice(CustomForm, forms.Form):
class TreatmentDeletionForm(FinalForm):
confirm_msg = _(
- u"Are you sure you want to delete this treatment? All changes "
- u"made to the associated finds since this treatment record will be "
- u"lost!")
- confirm_end_msg = _(u"Would you like to delete this treatment?")
+ "Are you sure you want to delete this treatment? All changes "
+ "made to the associated finds since this treatment record will be "
+ "lost!")
+ confirm_end_msg = _("Would you like to delete this treatment?")
class QAFindTreatmentForm(IshtarForm):
@@ -428,16 +428,16 @@ class QAFindTreatmentForm(IshtarForm):
label=_("Year"), initial=lambda: datetime.datetime.now().year,
validators=[validators.MinValueValidator(1000),
validators.MaxValueValidator(2100)], required=False)
- start_date = forms.DateField(label=_(u"Precise date"), required=False,
+ start_date = forms.DateField(label=_("Precise date"), required=False,
widget=DatePicker)
person = forms.IntegerField(
- label=_(u"Responsible"),
+ label=_("Responsible"),
widget=widgets.JQueryAutoComplete(
reverse_lazy('autocomplete-person'), associated_model=Person,
new=True),
validators=[valid_id(Person)], required=False)
organization = forms.IntegerField(
- label=_(u"Organization"),
+ label=_("Organization"),
widget=widgets.JQueryAutoComplete(
reverse_lazy('autocomplete-organization'),
associated_model=Organization, new=True),
@@ -456,19 +456,21 @@ class QAFindTreatmentForm(IshtarForm):
models.TreatmentType.objects.filter(
available=True, change_reference_location=True).all())
- self.treatment_type_ref_choices = u"".join([
- u"<option value='{}'>{}</option>".format(tt.pk, str(tt))
+ self.treatment_type_ref_choices = "".join(
+ "<option value='{}'>{}</option>".format(tt.pk, str(tt))
for tt in tt_change_ref_loca
- ])
+ )
+
tt_change_current_loca = list(
models.TreatmentType.objects.filter(
available=True, change_current_location=True).all())
- self.treatment_type_current_choices = u"".join([
- u"<option value='{}'>{}</option>".format(tt.pk, str(tt))
+ self.treatment_type_current_choices = "".join(
+ "<option value='{}'>{}</option>".format(tt.pk, str(tt))
for tt in tt_change_current_loca
- ])
+ )
+
self.treatment_type_all_choices = self.treatment_type_ref_choices + \
self.treatment_type_current_choices
@@ -496,9 +498,9 @@ class QAFindTreatmentForm(IshtarForm):
if self.cleaned_data['start_date']:
self.cleaned_data['year'] = self.cleaned_data['start_date'].year
else:
- raise forms.ValidationError(_(u"At least a year is required."))
+ raise forms.ValidationError(_("At least a year is required."))
if not self.cleaned_data.get('treatment_type', None):
- raise forms.ValidationError(_(u"Treatment type is required."))
+ raise forms.ValidationError(_("Treatment type is required."))
return self.cleaned_data
@@ -511,7 +513,7 @@ class QAFindTreatmentForm(IshtarForm):
treat_state, __ = models.TreatmentState.objects.get_or_create(
txt_idx='completed',
defaults={
- 'label': _(u"Completed"), 'executed': True,
+ 'label': _("Completed"), 'executed': True,
'available': True})
t = models.Treatment.objects.create(
container=container,
@@ -550,8 +552,8 @@ class QAFindTreatmentForm(IshtarForm):
find.save()
-SLICING = (("month", _(u"months")), ('year', _(u"years")),)
-DATE_SOURCE = (("start", _(u"Start date")), ("end", _(u"Closing date")),)
+SLICING = (("month", _("months")), ('year', _("years")),)
+DATE_SOURCE = (("start", _("Start date")), ("end", _("Closing date")),)
class DashboardForm(IshtarForm):
@@ -561,9 +563,9 @@ class DashboardForm(IshtarForm):
label=_("Date get from"), choices=DATE_SOURCE, required=False)
treatment_type = forms.ChoiceField(label=_("Treatment type"), choices=[],
required=False)
- after = forms.DateField(label=_(u"Date after"),
+ after = forms.DateField(label=_("Date after"),
widget=DatePicker, required=False)
- before = forms.DateField(label=_(u"Date before"),
+ before = forms.DateField(label=_("Date before"),
widget=DatePicker, required=False)
def __init__(self, *args, **kwargs):
@@ -600,31 +602,31 @@ class AdministrativeActTreatmentSelect(TableSelect):
_model = AdministrativeAct
search_vector = forms.CharField(
- label=_(u"Full text search"), widget=widgets.SearchWidget(
+ label=_("Full text search"), widget=widgets.SearchWidget(
'archaeological-operations', 'administrativeact',
'administrativeacttreatment',
))
year = forms.IntegerField(label=_("Year"))
index = forms.IntegerField(label=_("Index"))
act_type = forms.ChoiceField(label=_("Act type"), choices=[])
- indexed = forms.NullBooleanField(label=_(u"Indexed?"))
- act_object = forms.CharField(label=_(u"Object"),
+ indexed = forms.NullBooleanField(label=_("Indexed?"))
+ act_object = forms.CharField(label=_("Object"),
max_length=300)
signature_date_after = forms.DateField(
- label=_(u"Signature date after"), widget=DatePicker)
+ label=_("Signature date after"), widget=DatePicker)
signature_date_before = forms.DateField(
- label=_(u"Signature date before"), widget=DatePicker)
+ label=_("Signature date before"), widget=DatePicker)
treatment__name = forms.CharField(
- label=_(u"Treatment name"), max_length=200)
- treatment__year = forms.IntegerField(label=_(u"Treatment year"))
- treatment__index = forms.IntegerField(label=_(u"Treatment index"))
+ label=_("Treatment name"), max_length=200)
+ treatment__year = forms.IntegerField(label=_("Treatment year"))
+ treatment__index = forms.IntegerField(label=_("Treatment index"))
treatment__other_reference = forms.CharField(
- max_length=200, label=_(u"Treatment internal reference"))
- treatment__treatment_types = forms.ChoiceField(label=_(u"Treatment type"),
+ max_length=200, label=_("Treatment internal reference"))
+ treatment__treatment_types = forms.ChoiceField(label=_("Treatment type"),
choices=[])
history_modifier = forms.IntegerField(
- label=_(u"Modified by"),
+ label=_("Modified by"),
widget=widgets.JQueryAutoComplete(
reverse_lazy('autocomplete-person',
args=['0', 'user']),
@@ -654,9 +656,9 @@ class AdministrativeActTreatmentFormSelection(
class AdministrativeActTreatmentForm(AdministrativeActForm):
- form_admin_name = _(u"Treatment - Administrative act - General")
+ form_admin_name = _("Treatment - Administrative act - General")
form_slug = "treatment-adminact-general"
- act_type = forms.ChoiceField(label=_(u"Act type"), choices=[])
+ act_type = forms.ChoiceField(label=_("Act type"), choices=[])
TYPES = [
FieldType('act_type', ActType,
@@ -674,51 +676,51 @@ class AdministrativeActTreatmentModifForm(
class TreatmentFileSelect(DocumentItemSelect):
_model = models.TreatmentFile
- form_admin_name = _(u"Treatment file - 001 - Search")
+ form_admin_name = _("Treatment file - 001 - Search")
form_slug = "treatmentfile-001-search"
search_vector = forms.CharField(
- label=_(u"Full text search"), widget=widgets.SearchWidget(
+ label=_("Full text search"), widget=widgets.SearchWidget(
'archaeological-finds', 'treatmentfile'
))
- name = forms.CharField(label=_(u"Name"))
- internal_reference = forms.CharField(label=_(u"Internal ref."))
- year = forms.IntegerField(label=_(u"Year"))
- index = forms.IntegerField(label=_(u"Index"))
- type = forms.ChoiceField(label=_(u"Type"), choices=[])
+ name = forms.CharField(label=_("Name"))
+ internal_reference = forms.CharField(label=_("Internal ref."))
+ year = forms.IntegerField(label=_("Year"))
+ index = forms.IntegerField(label=_("Index"))
+ type = forms.ChoiceField(label=_("Type"), choices=[])
in_charge = forms.IntegerField(
- label=_(u"In charge"),
+ label=_("In charge"),
widget=widgets.JQueryAutoComplete(
reverse_lazy('autocomplete-person'),
associated_model=Person),
validators=[valid_id(Person)])
applicant = forms.IntegerField(
- label=_(u"Applicant"),
+ label=_("Applicant"),
widget=widgets.JQueryAutoComplete(
reverse_lazy('autocomplete-person'),
associated_model=Person),
validators=[valid_id(Person)])
applicant_organisation = forms.IntegerField(
- label=_(u"Applicant organisation"),
+ label=_("Applicant organisation"),
widget=widgets.JQueryAutoComplete(
reverse_lazy('autocomplete-organization'),
associated_model=Organization),
validators=[valid_id(Organization)])
- end_date = forms.DateField(label=_(u"Closing date"), required=False,
+ end_date = forms.DateField(label=_("Closing date"), required=False,
widget=DatePicker)
exhibition_start_before = forms.DateField(
- label=_(u"Exhibition started before"), widget=DatePicker
+ label=_("Exhibition started before"), widget=DatePicker
)
exhibition_start_after = forms.DateField(
- label=_(u"Exhibition started after"), widget=DatePicker
+ label=_("Exhibition started after"), widget=DatePicker
)
exhibition_end_before = forms.DateField(
- label=_(u"Exhibition ended before"), widget=DatePicker
+ label=_("Exhibition ended before"), widget=DatePicker
)
exhibition_end_after = forms.DateField(
- label=_(u"Exhibition ended after"), widget=DatePicker
+ label=_("Exhibition ended after"), widget=DatePicker
)
def __init__(self, *args, **kwargs):
@@ -754,7 +756,7 @@ class TreatmentFileFormSelectionMultiple(MultiSearchForm):
class TreatmentFileForm(CustomForm, ManageOldType):
- form_label = _(u"Treatment request")
+ form_label = _("Treatment request")
base_models = ['treatment_type_type']
associated_models = {
'type': models.TreatmentFileType, 'in_charge': Person,
@@ -764,38 +766,38 @@ class TreatmentFileForm(CustomForm, ManageOldType):
extra_form_modals = ["person", "organization"]
need_user_for_initialization = True
- name = forms.CharField(label=_(u"Name"),
+ name = forms.CharField(label=_("Name"),
max_length=1000, required=False)
year = forms.IntegerField(label=_("Year"),
initial=lambda: datetime.datetime.now().year,
validators=[validators.MinValueValidator(1000),
validators.MaxValueValidator(2100)])
internal_reference = forms.CharField(
- label=_(u"Internal ref."), max_length=60, required=False)
+ label=_("Internal ref."), max_length=60, required=False)
external_id = forms.CharField(
- label=_(u"External ref."), max_length=200, required=False)
+ label=_("External ref."), max_length=200, required=False)
type = forms.ChoiceField(
- label=_(u"Type"), choices=[])
+ label=_("Type"), choices=[])
in_charge = forms.IntegerField(
- label=_(u"Responsible"),
+ label=_("Responsible"),
widget=widgets.JQueryAutoComplete(
reverse_lazy('autocomplete-person'), associated_model=Person,
new=True),
validators=[valid_id(Person)])
applicant = forms.IntegerField(
- label=_(u"Applicant"),
+ label=_("Applicant"),
widget=widgets.JQueryAutoComplete(
reverse_lazy('autocomplete-person'), associated_model=Person,
new=True),
validators=[valid_id(Person)], required=False)
applicant_organisation = forms.IntegerField(
- label=_(u"Applicant organisation"),
+ label=_("Applicant organisation"),
widget=widgets.JQueryAutoComplete(
reverse_lazy('autocomplete-organization'),
associated_model=Organization, new=True),
validators=[valid_id(Organization)], required=False)
associated_basket = forms.IntegerField(
- label=_(u"Associated basket"),
+ label=_("Associated basket"),
widget=widgets.JQueryAutoComplete(
reverse_lazy('autocomplete-findbasket'),
associated_model=models.FindBasket), required=False)
@@ -805,15 +807,15 @@ class TreatmentFileForm(CustomForm, ManageOldType):
label=_("Exhibition start date"), required=False, widget=DatePicker)
exhibition_end_date = forms.DateField(
label=_("Exhibition end date"), required=False, widget=DatePicker)
- comment = forms.CharField(label=_(u"Comment"),
+ comment = forms.CharField(label=_("Comment"),
widget=forms.Textarea, required=False)
reception_date = forms.DateField(
- label=_(u"Reception date"), required=False, widget=DatePicker,
+ label=_("Reception date"), required=False, widget=DatePicker,
initial=lambda: datetime.datetime.now())
- creation_date = forms.DateField(label=_(u"Start date"), required=False,
+ creation_date = forms.DateField(label=_("Start date"), required=False,
widget=DatePicker,
initial=lambda: datetime.datetime.now())
- end_date = forms.DateField(label=_(u"Closing date"), required=False,
+ end_date = forms.DateField(label=_("Closing date"), required=False,
widget=DatePicker)
TYPES = [
@@ -839,7 +841,7 @@ class TreatmentFileForm(CustomForm, ManageOldType):
class TreatmentFileModifyForm(TreatmentFileForm):
- index = forms.IntegerField(label=_(u"Index"))
+ index = forms.IntegerField(label=_("Index"))
id = forms.IntegerField(label=' ', widget=forms.HiddenInput, required=False)
def __init__(self, *args, **kwargs):
@@ -862,20 +864,20 @@ class TreatmentFileModifyForm(TreatmentFileForm):
.filter(year=year, index=index).exclude(pk=pk)
if index and q.count():
raise forms.ValidationError(
- _(u"Another treatment request with this index exists for {}."
+ _("Another treatment request with this index exists for {}."
).format(year))
return cleaned_data
class TreatmentFileDeletionForm(FinalForm):
- confirm_msg = _(u"Are you sure you want to delete this treatment request?")
- confirm_end_msg = _(u"Would you like to delete this treatment request?")
+ confirm_msg = _("Are you sure you want to delete this treatment request?")
+ confirm_end_msg = _("Would you like to delete this treatment request?")
DATE_SOURCE_FILE = (
- ("creation", _(u"Creation date")),
- ("reception", _(u"Reception date")),
- ("end", _(u"Closing date")),)
+ ("creation", _("Creation date")),
+ ("reception", _("Reception date")),
+ ("end", _("Closing date")),)
class DashboardTreatmentFileForm(IshtarForm):
@@ -885,9 +887,9 @@ class DashboardTreatmentFileForm(IshtarForm):
label=_("Date get from"), choices=DATE_SOURCE_FILE, required=False)
treatmentfile_type = forms.ChoiceField(label=_("Treatment request type"),
choices=[], required=False)
- after = forms.DateField(label=_(u"Date after"),
+ after = forms.DateField(label=_("Date after"),
widget=DatePicker, required=False)
- before = forms.DateField(label=_(u"Date before"),
+ before = forms.DateField(label=_("Date before"),
widget=DatePicker, required=False)
def __init__(self, *args, **kwargs):
@@ -922,35 +924,35 @@ class AdministrativeActTreatmentFileSelect(TableSelect):
_model = AdministrativeAct
search_vector = forms.CharField(
- label=_(u"Full text search"), widget=widgets.SearchWidget(
+ label=_("Full text search"), widget=widgets.SearchWidget(
'archaeological-operations', 'administrativeact',
'administrativeacttreatmentfile',
))
year = forms.IntegerField(label=_("Year"))
index = forms.IntegerField(label=_("Index"))
act_type = forms.ChoiceField(label=_("Act type"), choices=[])
- indexed = forms.NullBooleanField(label=_(u"Indexed?"))
- act_object = forms.CharField(label=_(u"Object"),
+ indexed = forms.NullBooleanField(label=_("Indexed?"))
+ act_object = forms.CharField(label=_("Object"),
max_length=300)
signature_date_after = forms.DateField(
- label=_(u"Signature date after"), widget=DatePicker)
+ label=_("Signature date after"), widget=DatePicker)
signature_date_before = forms.DateField(
- label=_(u"Signature date before"), widget=DatePicker)
+ label=_("Signature date before"), widget=DatePicker)
treatment_file__name = forms.CharField(
- label=_(u"Treatment request name"), max_length=200)
+ label=_("Treatment request name"), max_length=200)
treatment_file__year = forms.IntegerField(
- label=_(u"Treatment request year"))
+ label=_("Treatment request year"))
treatment_file__index = forms.IntegerField(
- label=_(u"Treatment request index"))
+ label=_("Treatment request index"))
treatment_file__internal_reference = forms.CharField(
- max_length=200, label=_(u"Treatment request internal reference"))
+ max_length=200, label=_("Treatment request internal reference"))
treatment_file__type = forms.ChoiceField(
- label=_(u"Treatment request type"), choices=[])
+ label=_("Treatment request type"), choices=[])
history_modifier = forms.IntegerField(
- label=_(u"Modified by"),
+ label=_("Modified by"),
widget=widgets.JQueryAutoComplete(
reverse_lazy('autocomplete-person',
args=['0', 'user']),
@@ -981,9 +983,9 @@ class AdministrativeActTreatmentFileFormSelection(
class AdministrativeActTreatmentFileForm(AdministrativeActForm):
- form_admin_name = _(u"Treatment request - Administrative act - General")
+ form_admin_name = _("Treatment request - Administrative act - General")
form_slug = "treatmentfile-adminact-general"
- act_type = forms.ChoiceField(label=_(u"Act type"), choices=[])
+ act_type = forms.ChoiceField(label=_("Act type"), choices=[])
TYPES = [
FieldType('act_type', ActType,
diff --git a/archaeological_finds/ishtar_menu.py b/archaeological_finds/ishtar_menu.py
index feb715368..ee0d1b908 100644
--- a/archaeological_finds/ishtar_menu.py
+++ b/archaeological_finds/ishtar_menu.py
@@ -29,109 +29,109 @@ from . import models
MENU_SECTIONS = [
(50,
SectionItem(
- 'find_management', _(u"Find"),
+ 'find_management', _("Find"),
profile_restriction='find',
css='menu-find',
childs=[
MenuItem(
- 'find_search', _(u"Search"),
+ 'find_search', _("Search"),
model=models.Find,
access_controls=['view_find',
'view_own_find']),
MenuItem(
- 'find_creation', _(u"Creation"),
+ 'find_creation', _("Creation"),
model=models.Find,
access_controls=['add_find',
'add_own_find']),
MenuItem(
- 'find_modification', _(u"Modification"),
+ 'find_modification', _("Modification"),
model=models.Find,
access_controls=['change_find',
'change_own_find']),
MenuItem(
- 'find_deletion', _(u"Deletion"),
+ 'find_deletion', _("Deletion"),
model=models.Find,
access_controls=['change_find',
'change_own_find']),
SectionItem(
- 'find_basket', _(u"Basket"),
+ 'find_basket', _("Basket"),
childs=[
MenuItem('find_basket_search',
- _(u"Search"),
+ _("Search"),
model=models.FindBasket,
access_controls=['view_find',
'view_own_find']),
MenuItem('find_basket_creation',
- _(u"Creation"),
+ _("Creation"),
model=models.FindBasket,
access_controls=['view_find',
'view_own_find']),
MenuItem('find_basket_modification',
- _(u"Modification"),
+ _("Modification"),
model=models.FindBasket,
access_controls=[
'view_find',
'view_own_find']),
MenuItem('find_basket_modification_add',
- _(u"Manage items"),
+ _("Manage items"),
model=models.FindBasket,
access_controls=[
'view_find',
'view_own_find']),
MenuItem('find_basket_deletion',
- _(u"Deletion"),
+ _("Deletion"),
model=models.FindBasket,
access_controls=['view_find',
'view_own_find']),
]),
# MenuItem(
- # 'treatment_creation', _(u"Add a treatment"),
+ # 'treatment_creation', _("Add a treatment"),
# model=models.Treatment,
# access_controls=['change_find',
# 'change_own_find']),
])),
(60,
SectionItem(
- 'treatmentfle_management', _(u"Treatment request"),
+ 'treatmentfle_management', _("Treatment request"),
profile_restriction='warehouse',
css='menu-warehouse',
childs=[
MenuItem('treatmentfle_search',
- _(u"Search"),
+ _("Search"),
model=models.TreatmentFile,
access_controls=['view_treatmentfile',
'view_own_treatmentfile']),
MenuItem('treatmentfle_creation',
- _(u"Creation"),
+ _("Creation"),
model=models.TreatmentFile,
access_controls=['change_treatmentfile',
'change_own_treatmentfile']),
MenuItem('treatmentfle_modification',
- _(u"Modification"),
+ _("Modification"),
model=models.TreatmentFile,
access_controls=['change_treatmentfile',
'change_own_treatmentfile']),
MenuItem('treatmentfle_deletion',
- _(u"Deletion"),
+ _("Deletion"),
model=models.TreatmentFile,
access_controls=['change_treatmentfile',
'change_own_treatmentfile']),
SectionItem(
- 'admin_act_fletreatments', _(u"Administrative act"),
+ 'admin_act_fletreatments', _("Administrative act"),
childs=[
MenuItem('treatmentfle_admacttreatmentfle_search',
- _(u"Search"),
+ _("Search"),
model=AdministrativeAct,
access_controls=['change_administrativeact']),
MenuItem('treatmentfle_admacttreatmentfle',
- _(u"Creation"),
+ _("Creation"),
model=AdministrativeAct,
access_controls=['change_administrativeact']),
MenuItem('treatmentfle_admacttreatmentfle_modification',
- _(u"Modification"), model=AdministrativeAct,
+ _("Modification"), model=AdministrativeAct,
access_controls=['change_administrativeact']),
MenuItem('treatmentfle_admacttreatmentfle_deletion',
- _(u"Deletion"),
+ _("Deletion"),
model=AdministrativeAct,
access_controls=['change_administrativeact']),
]
@@ -140,57 +140,57 @@ MENU_SECTIONS = [
)),
(70,
SectionItem(
- 'treatment_management', _(u"Treatment"),
+ 'treatment_management', _("Treatment"),
profile_restriction='warehouse',
css='menu-warehouse',
childs=[
MenuItem('treatment_search',
- _(u"Search"),
+ _("Search"),
model=models.Treatment,
access_controls=['view_treatment',
'view_own_treatment']),
MenuItem(
'treatment_creation',
- _(u"Simple treatment - creation"),
+ _("Simple treatment - creation"),
model=models.Treatment,
access_controls=['change_find', 'change_own_find']),
MenuItem(
'treatment_creation_n1',
- _(u"Treatment many to one - creation"),
+ _("Treatment many to one - creation"),
model=models.Treatment,
access_controls=['change_find', 'change_own_find']),
MenuItem(
'treatment_creation_1n',
- _(u"Treatment one to many - creation"),
+ _("Treatment one to many - creation"),
model=models.Treatment,
access_controls=['change_find', 'change_own_find']),
MenuItem('treatment_modification',
- _(u"Modification"),
+ _("Modification"),
model=models.Treatment,
access_controls=['change_treatment',
'change_own_treatment']),
MenuItem('treatment_deletion',
- _(u"Deletion"),
+ _("Deletion"),
model=models.Treatment,
access_controls=['change_treatment',
'change_own_treatment']),
SectionItem(
- 'admin_act_treatments', _(u"Administrative act"),
+ 'admin_act_treatments', _("Administrative act"),
childs=[
MenuItem('treatment_admacttreatment_search',
- _(u"Search"),
+ _("Search"),
model=AdministrativeAct,
access_controls=['view_administrativeact']),
MenuItem('treatment_admacttreatment',
- _(u"Creation"),
+ _("Creation"),
model=AdministrativeAct,
access_controls=['add_administrativeact']),
MenuItem(
'treatment_admacttreatment_modification',
- _(u"Modification"), model=AdministrativeAct,
+ _("Modification"), model=AdministrativeAct,
access_controls=['change_administrativeact']),
MenuItem('treatment_admacttreatment_deletion',
- _(u"Deletion"),
+ _("Deletion"),
model=AdministrativeAct,
access_controls=['change_administrativeact']),
]),
diff --git a/archaeological_finds/lookups.py b/archaeological_finds/lookups.py
index 2c17d890a..b8ce8400d 100644
--- a/archaeological_finds/lookups.py
+++ b/archaeological_finds/lookups.py
@@ -25,7 +25,7 @@ class BaseFindLookup(LookupChannel):
'cache_complete_id')[:20]
def format_item_display(self, item):
- return u"<span class='ajax-label'>%s</span>" % item.cache_complete_id
+ return "<span class='ajax-label'>%s</span>" % item.cache_complete_id
@register('find')
@@ -44,7 +44,7 @@ class FindLookup(LookupChannel):
'cached_label')[:20]
def format_item_display(self, item):
- return u"<span class='ajax-label'>%s</span>" % item.full_label
+ return "<span class='ajax-label'>%s</span>" % item.full_label
def format_match(self, obj):
return escape(force_text(obj.full_label))
@@ -65,7 +65,7 @@ class TreatmentLookup(LookupChannel):
'cached_label')[:20]
def format_item_display(self, item):
- return u"<span class='ajax-label'>%s</span>" % item.cached_label
+ return "<span class='ajax-label'>%s</span>" % item.cached_label
@register('treatment_file')
@@ -83,7 +83,7 @@ class TreatmentFileLookup(LookupChannel):
'cached_label')[:20]
def format_item_display(self, item):
- return u"<span class='ajax-label'>%s</span>" % item.cached_label
+ return "<span class='ajax-label'>%s</span>" % item.cached_label
@register('material_type')
diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py
index 1bfe56708..c7065166e 100644
--- a/archaeological_finds/models_finds.py
+++ b/archaeological_finds/models_finds.py
@@ -502,11 +502,11 @@ class BaseFind(BulkUpdatedItem, BaseHistorizedItem, GeoItem,
for mat in find.material_types.all():
if mat.code:
materials.add(mat.code)
- c_id.append(u'-'.join(sorted(list(materials))))
+ c_id.append('-'.join(sorted(list(materials))))
c_id.append(self.context_record.label)
- c_id.append((u'{:0' + str(settings.ISHTAR_FINDS_INDEX_ZERO_LEN) + 'd}'
+ c_id.append(('{:0' + str(settings.ISHTAR_FINDS_INDEX_ZERO_LEN) + 'd}'
).format(self.index))
return settings.JOINT.join(c_id)
@@ -519,7 +519,7 @@ class BaseFind(BulkUpdatedItem, BaseHistorizedItem, GeoItem,
return ALTERNATE_CONFIGS[profile.config].basefind_short_id(self)
# OPE|FIND_index
c_id = [self._ope_code()]
- c_id.append((u'{:0' + str(settings.ISHTAR_FINDS_INDEX_ZERO_LEN) + 'd}'
+ c_id.append(('{:0' + str(settings.ISHTAR_FINDS_INDEX_ZERO_LEN) + 'd}'
).format(self.index))
return settings.JOINT.join(c_id)
@@ -2616,7 +2616,7 @@ class Find(BulkUpdatedItem, ValueGetter, DocumentItem, BaseHistorizedItem,
"""
bfs = self.base_finds
profile = get_current_profile()
- if profile.find_index == u'O':
+ if profile.find_index == 'O':
bfs = bfs.filter(
context_record__operation__pk__isnull=False).order_by(
'-context_record__operation__start_date')
@@ -2625,7 +2625,7 @@ class Find(BulkUpdatedItem, ValueGetter, DocumentItem, BaseHistorizedItem,
operation = bfs.all()[0].context_record.operation
q = Find.objects \
.filter(base_finds__context_record__operation=operation)
- elif profile.find_index == u'CR':
+ elif profile.find_index == 'CR':
bfs = bfs.filter(
context_record__pk__isnull=False).order_by(
'context_record__pk')
diff --git a/archaeological_finds/models_treatments.py b/archaeological_finds/models_treatments.py
index 3f1c14069..7f3aab284 100644
--- a/archaeological_finds/models_treatments.py
+++ b/archaeological_finds/models_treatments.py
@@ -45,12 +45,12 @@ from ishtar_common.utils import cached_label_changed, get_current_year, \
class TreatmentState(GeneralType):
- executed = models.BooleanField(_(u"Treatment is executed"), default=False)
- order = models.IntegerField(verbose_name=_(u"Order"), default=10)
+ executed = models.BooleanField(_("Treatment is executed"), default=False)
+ order = models.IntegerField(verbose_name=_("Order"), default=10)
class Meta:
- verbose_name = _(u"Treatment state type")
- verbose_name_plural = _(u"Treatment state types")
+ verbose_name = _("Treatment state type")
+ verbose_name_plural = _("Treatment state types")
ordering = ('order', 'label',)
@classmethod
@@ -89,11 +89,11 @@ class Treatment(DashboardFormItem, ValueGetter, DocumentItem,
"person__pk": "person__pk", # used by dynamic_table_documents
}
COL_LABELS = {
- "downstream_cached_label": _(u"Downstream find"),
- "upstream_cached_label": _(u"Upstream find"),
- "treatment_types__label": _(u"Type"),
- "treatment_state__label": _(u"State"),
- "person__cached_label": _(u"Responsible"),
+ "downstream_cached_label": _("Downstream find"),
+ "upstream_cached_label": _("Upstream find"),
+ "treatment_types__label": _("Type"),
+ "treatment_state__label": _("State"),
+ "person__cached_label": _("Responsible"),
"scientific_monitoring_manager__cached_label": _(
"Scientific monitoring manager"),
}
@@ -159,80 +159,80 @@ class Treatment(DashboardFormItem, ValueGetter, DocumentItem,
PARENT_SEARCH_VECTORS = ['person', 'organization']
objects = ExternalIdManager()
- label = models.CharField(_(u"Label"), blank=True, null=True,
+ label = models.CharField(_("Label"), blank=True, null=True,
max_length=200)
- other_reference = models.CharField(_(u"Other ref."), blank=True, null=True,
+ other_reference = models.CharField(_("Other ref."), blank=True, null=True,
max_length=200)
- year = models.IntegerField(_(u"Year"), default=get_current_year)
- index = models.IntegerField(_(u"Index"), default=1)
+ year = models.IntegerField(_("Year"), default=get_current_year)
+ index = models.IntegerField(_("Index"), default=1)
file = models.ForeignKey(
'TreatmentFile', related_name='treatments', blank=True, null=True,
on_delete=models.SET_NULL,
- verbose_name=_(u"Associated request"))
+ verbose_name=_("Associated request"))
treatment_types = models.ManyToManyField(
- TreatmentType, verbose_name=_(u"Treatment type"))
+ TreatmentType, verbose_name=_("Treatment type"))
treatment_state = models.ForeignKey(
- TreatmentState, verbose_name=_(u"State"),
+ TreatmentState, verbose_name=_("State"),
default=TreatmentState.get_default
)
executed = models.BooleanField(
- _(u"Treatment have been executed"), default=False)
+ _("Treatment have been executed"), default=False)
location = models.ForeignKey(
- Warehouse, verbose_name=_(u"Location"), blank=True, null=True,
+ Warehouse, verbose_name=_("Location"), blank=True, null=True,
on_delete=models.SET_NULL,
help_text=_(
- u"Location where the treatment is done. Target warehouse for "
- u"a move."))
+ "Location where the treatment is done. Target warehouse for "
+ "a move."))
person = models.ForeignKey(
- Person, verbose_name=_(u"Responsible"), blank=True, null=True,
+ Person, verbose_name=_("Responsible"), blank=True, null=True,
on_delete=models.SET_NULL, related_name='treatments')
scientific_monitoring_manager = models.ForeignKey(
Person, verbose_name=_('Scientific monitoring manager'), blank=True,
null=True, on_delete=models.SET_NULL,
related_name='manage_treatments')
organization = models.ForeignKey(
- Organization, verbose_name=_(u"Organization"), blank=True, null=True,
+ Organization, verbose_name=_("Organization"), blank=True, null=True,
on_delete=models.SET_NULL, related_name='treatments')
- external_id = models.CharField(_(u"External ID"), blank=True, null=True,
+ external_id = models.CharField(_("External ID"), blank=True, null=True,
max_length=200)
comment = models.TextField(_("Comment"), blank=True, default="")
description = models.TextField(_("Description"), blank=True, default="")
goal = models.TextField(_("Goal"), blank=True, default="")
- start_date = models.DateField(_(u"Start date"), blank=True, null=True)
- end_date = models.DateField(_(u"Closing date"), blank=True, null=True)
+ start_date = models.DateField(_("Start date"), blank=True, null=True)
+ end_date = models.DateField(_("Closing date"), blank=True, null=True)
creation_date = models.DateTimeField(default=datetime.datetime.now)
- container = models.ForeignKey(Container, verbose_name=_(u"Container"),
+ container = models.ForeignKey(Container, verbose_name=_("Container"),
on_delete=models.SET_NULL,
blank=True, null=True)
- estimated_cost = models.FloatField(_(u"Estimated cost"),
+ estimated_cost = models.FloatField(_("Estimated cost"),
blank=True, null=True)
- quoted_cost = models.FloatField(_(u"Quoted cost"),
+ quoted_cost = models.FloatField(_("Quoted cost"),
blank=True, null=True)
- realized_cost = models.FloatField(_(u"Realized cost"),
+ realized_cost = models.FloatField(_("Realized cost"),
blank=True, null=True)
- insurance_cost = models.FloatField(_(u"Insurance cost"),
+ insurance_cost = models.FloatField(_("Insurance cost"),
blank=True, null=True)
documents = models.ManyToManyField(
- Document, related_name='treatments', verbose_name=_(u"Documents"),
+ Document, related_name='treatments', verbose_name=_("Documents"),
blank=True)
main_image = models.ForeignKey(
Document, related_name='main_image_treatments',
on_delete=models.SET_NULL,
- verbose_name=_(u"Main image"), blank=True, null=True)
+ verbose_name=_("Main image"), blank=True, null=True)
cached_label = models.TextField(_("Cached name"), blank=True, default="",
db_index=True)
history = HistoricalRecords(bases=[HistoryModel])
class Meta:
- verbose_name = _(u"Treatment")
- verbose_name_plural = _(u"Treatments")
+ verbose_name = _("Treatment")
+ verbose_name_plural = _("Treatments")
unique_together = ('year', 'index')
permissions = (
- ("view_treatment", u"Can view all Treatments"),
- ("view_own_treatment", u"Can view own Treatment"),
- ("add_own_treatment", u"Can add own Treatment"),
- ("change_own_treatment", u"Can change own Treatment"),
- ("delete_own_treatment", u"Can delete own Treatment"),
+ ("view_treatment", "Can view all Treatments"),
+ ("view_own_treatment", "Can view own Treatment"),
+ ("add_own_treatment", "Can add own Treatment"),
+ ("change_own_treatment", "Can change own Treatment"),
+ ("delete_own_treatment", "Can delete own Treatment"),
)
ordering = ("-year", "-index", "-start_date")
indexes = [
@@ -244,7 +244,7 @@ class Treatment(DashboardFormItem, ValueGetter, DocumentItem,
@property
def short_class_name(self):
- return _(u"TREATMENT")
+ return _("TREATMENT")
@property
def limited_finds(self):
@@ -274,10 +274,7 @@ class Treatment(DashboardFormItem, ValueGetter, DocumentItem,
'basket' not in str(menu_filtr['find']):
q = Q(upstream=menu_filtr['find']) | Q(
downstream=menu_filtr['find'])
- if replace_query:
- replace_query = replace_query | q
- else:
- replace_query = q
+ replace_query = replace_query | q if replace_query else q
owns = super(Treatment, cls).get_owns(
user, replace_query=replace_query, limit=limit,
values=values, get_short_menu_class=get_short_menu_class)
@@ -291,18 +288,18 @@ class Treatment(DashboardFormItem, ValueGetter, DocumentItem,
items = [str(getattr(self, k))
for k in ['year', 'index', 'other_reference', 'label'] if
getattr(self, k)]
- return u'{} | {}'.format(u"-".join(items), self.treatment_types_lbl())
+ return '{} | {}'.format("-".join(items), self.treatment_types_lbl())
def _get_base_image_path(self,):
- return u"{}/{}/{}".format(self.SLUG, self.year, self.index)
+ return "{}/{}/{}".format(self.SLUG, self.year, self.index)
def treatment_types_lbl(self):
"""
Treatment types label
:return: string
"""
- return u" ; ".join([str(t) for t in self.treatment_types.all()])
- treatment_types_lbl.short_description = _(u"Treatment types")
+ return " ; ".join(str(t) for t in self.treatment_types.all())
+ treatment_types_lbl.short_description = _("Treatment types")
treatment_types_lbl.admin_order_field = 'treatment_types__label'
def downstream_lbl(self):
@@ -310,8 +307,8 @@ class Treatment(DashboardFormItem, ValueGetter, DocumentItem,
Downstream finds label
:return: string
"""
- return u" ; ".join([f.cached_label for f in self.downstream.all()])
- downstream_lbl.short_description = _(u"Downstream finds")
+ return " ; ".join(f.cached_label for f in self.downstream.all())
+ downstream_lbl.short_description = _("Downstream finds")
downstream_lbl.admin_order_field = 'downstream__cached_label'
def upstream_lbl(self):
@@ -319,7 +316,7 @@ class Treatment(DashboardFormItem, ValueGetter, DocumentItem,
Upstream finds label
:return: string
"""
- return " ; ".join([f.cached_label for f in self.upstream.all()])
+ return " ; ".join(f.cached_label for f in self.upstream.all())
upstream_lbl.short_description = _("Upstream finds")
upstream_lbl.admin_order_field = 'upstream__cached_label'
@@ -339,14 +336,20 @@ class Treatment(DashboardFormItem, ValueGetter, DocumentItem,
prefix=prefix, no_values=no_values, filtr=filtr, **kwargs)
if not filtr or prefix + "upstream_finds" in filtr:
values[prefix + "upstream_finds"] = " ; ".join(
- [str(up) for up in self.upstream.all()])
+ str(up) for up in self.upstream.all()
+ )
+
if not filtr or prefix + "downstream_finds" in filtr:
values[prefix + "downstream_finds"] = " ; ".join(
- [str(up) for up in self.downstream.all()])
+ str(up) for up in self.downstream.all()
+ )
+
if not filtr or prefix + "operations" in filtr:
values[prefix + "operations"] = " ; ".join(
- [str(ope) for ope in self.get_query_operations().all()])
+ str(ope) for ope in self.get_query_operations().all()
+ )
+
if 'associatedfind_' not in prefix and self.upstream.count():
find = self.upstream.all()[0]
new_prefix = prefix + 'associatedfind_'
@@ -382,13 +385,13 @@ class Treatment(DashboardFormItem, ValueGetter, DocumentItem,
resulting_find['history_modifier'] = self.history_modifier
new_find = Find.objects.create(**resulting_find)
- for k in m2m:
+ for k, v in m2m.items():
m2m_field = getattr(new_find, k)
try:
for value in m2m[k]:
m2m_field.add(value)
except TypeError:
- m2m_field.add(m2m[k])
+ m2m_field.add(v)
create_new_find = bool([tp for tp in treatment_types
if tp.create_new_find])
@@ -399,11 +402,11 @@ class Treatment(DashboardFormItem, ValueGetter, DocumentItem,
# datings are not explicitly part of the resulting_find
# need to reassociate with no duplicate
for dating in upstream_item.datings.all():
- is_present = False
- for current_dating in new_find.datings.all():
- if Dating.is_identical(current_dating, dating):
- is_present = True
- break
+ is_present = any(
+ Dating.is_identical(current_dating, dating)
+ for current_dating in new_find.datings.all()
+ )
+
if is_present:
continue
dating.pk = None # duplicate
@@ -617,8 +620,10 @@ class Treatment(DashboardFormItem, ValueGetter, DocumentItem,
@property
def associated_filename(self):
- return "-".join([str(slugify(getattr(self, attr)))
- for attr in ('year', 'index', 'label')])
+ return "-".join(
+ str(slugify(getattr(self, attr)))
+ for attr in ('year', 'index', 'label')
+ )
post_save.connect(cached_label_changed, sender=Treatment)
@@ -649,31 +654,31 @@ for attr in Treatment.HISTORICAL_M2M:
class AbsFindTreatments(models.Model):
- find = models.ForeignKey(Find, verbose_name=_(u"Find"),
+ find = models.ForeignKey(Find, verbose_name=_("Find"),
related_name='%(class)s_related')
- treatment = models.OneToOneField(Treatment, verbose_name=_(u"Treatment"),
+ treatment = models.OneToOneField(Treatment, verbose_name=_("Treatment"),
primary_key=True)
# primary_key is set to prevent django to ask for an id column
# treatment is not a real primary key
- treatment_nb = models.IntegerField(_(u"Order"))
+ treatment_nb = models.IntegerField(_("Order"))
TABLE_COLS = ["treatment__" + col for col in Treatment.TABLE_COLS] + \
['treatment_nb']
COL_LABELS = {
- 'treatment__treatment_type': _(u"Treatment type"),
- 'treatment__start_date': _(u"Start date"),
- 'treatment__end_date': _(u"End date"),
- 'treatment__location': _(u"Location"),
- 'treatment__container': _(u"Container"),
- 'treatment__person': _(u"Doer"),
- 'treatment__upstream': _(u"Related finds"),
- 'treatment__downstream': _(u"Related finds"),
+ 'treatment__treatment_type': _("Treatment type"),
+ 'treatment__start_date': _("Start date"),
+ 'treatment__end_date': _("End date"),
+ 'treatment__location': _("Location"),
+ 'treatment__container': _("Container"),
+ 'treatment__person': _("Doer"),
+ 'treatment__upstream': _("Related finds"),
+ 'treatment__downstream': _("Related finds"),
}
class Meta:
abstract = True
def __str__(self):
- return u"{} - {} [{}]".format(
+ return "{} - {} [{}]".format(
self.find, self.treatment, self.treatment_nb)
@@ -876,7 +881,7 @@ class FindTreatments(AbsFindTreatments):
DELETE_SQL = """
DROP VIEW IF EXISTS find_treatments;
"""
- upstream = models.BooleanField(_(u"Is upstream"))
+ upstream = models.BooleanField(_("Is upstream"))
class Meta:
managed = False
@@ -889,8 +894,8 @@ class TreatmentFileType(GeneralType):
treatment_type = models.ForeignKey(TreatmentType, blank=True, null=True)
class Meta:
- verbose_name = _(u"Treatment request type")
- verbose_name_plural = _(u"Treatment request types")
+ verbose_name = _("Treatment request type")
+ verbose_name_plural = _("Treatment request types")
ordering = ('label',)
@@ -985,32 +990,32 @@ class TreatmentFile(DashboardFormItem, ClosedItem, DocumentItem,
'exhibition_end_date__gte']
# fields
- year = models.IntegerField(_(u"Year"), default=get_current_year)
- index = models.IntegerField(_(u"Index"), default=1)
- internal_reference = models.CharField(_(u"Internal reference"), blank=True,
+ year = models.IntegerField(_("Year"), default=get_current_year)
+ index = models.IntegerField(_("Index"), default=1)
+ internal_reference = models.CharField(_("Internal reference"), blank=True,
null=True, max_length=200)
- external_id = models.CharField(_(u"External ID"), blank=True, null=True,
+ external_id = models.CharField(_("External ID"), blank=True, null=True,
max_length=200)
name = models.TextField(_("Name"), blank=True, default="")
type = models.ForeignKey(TreatmentFileType,
- verbose_name=_(u"Treatment request type"))
+ verbose_name=_("Treatment request type"))
in_charge = models.ForeignKey(
Person, related_name='treatmentfile_responsability',
- verbose_name=_(u"Person in charge"), on_delete=models.SET_NULL,
+ verbose_name=_("Person in charge"), on_delete=models.SET_NULL,
blank=True, null=True)
applicant = models.ForeignKey(
Person, related_name='treatmentfile_applicant',
- verbose_name=_(u"Applicant"), on_delete=models.SET_NULL,
+ verbose_name=_("Applicant"), on_delete=models.SET_NULL,
blank=True, null=True)
applicant_organisation = models.ForeignKey(
Organization, related_name='treatmentfile_applicant',
- verbose_name=_(u"Applicant organisation"), on_delete=models.SET_NULL,
+ verbose_name=_("Applicant organisation"), on_delete=models.SET_NULL,
blank=True, null=True)
- end_date = models.DateField(_(u"Closing date"), null=True, blank=True)
+ end_date = models.DateField(_("Closing date"), null=True, blank=True)
creation_date = models.DateField(
- _(u"Creation date"), default=datetime.date.today, blank=True,
+ _("Creation date"), default=datetime.date.today, blank=True,
null=True)
- reception_date = models.DateField(_(u'Reception date'), blank=True,
+ reception_date = models.DateField(_('Reception date'), blank=True,
null=True)
# exhibition
exhibition_name = models.TextField(_("Exhibition name"), blank=True,
@@ -1022,12 +1027,12 @@ class TreatmentFile(DashboardFormItem, ClosedItem, DocumentItem,
comment = models.TextField(_("Comment"), blank=True, default="")
documents = models.ManyToManyField(
- Document, related_name='treatment_files', verbose_name=_(u"Documents"),
+ Document, related_name='treatment_files', verbose_name=_("Documents"),
blank=True)
main_image = models.ForeignKey(
Document, related_name='main_image_treatment_files',
on_delete=models.SET_NULL,
- verbose_name=_(u"Main image"), blank=True, null=True)
+ verbose_name=_("Main image"), blank=True, null=True)
associated_basket = models.ForeignKey(
FindBasket, null=True, blank=True, on_delete=models.SET_NULL,
related_name='treatment_files'
@@ -1037,20 +1042,20 @@ class TreatmentFile(DashboardFormItem, ClosedItem, DocumentItem,
history = HistoricalRecords()
class Meta:
- verbose_name = _(u"Treatment request")
- verbose_name_plural = _(u"Treatment requests")
+ verbose_name = _("Treatment request")
+ verbose_name_plural = _("Treatment requests")
unique_together = ('year', 'index')
permissions = (
("view_treatmentfile",
- u"Can view all Treatment requests"),
+ "Can view all Treatment requests"),
("view_own_treatmentfile",
- u"Can view own Treatment request"),
+ "Can view own Treatment request"),
("add_own_treatmentfile",
- u"Can add own Treatment request"),
+ "Can add own Treatment request"),
("change_own_treatmentfile",
- u"Can change own Treatment request"),
+ "Can change own Treatment request"),
("delete_own_treatmentfile",
- u"Can delete own Treatment request"),
+ "Can delete own Treatment request"),
)
ordering = ('cached_label',)
indexes = [
@@ -1062,7 +1067,7 @@ class TreatmentFile(DashboardFormItem, ClosedItem, DocumentItem,
@property
def short_class_name(self):
- return _(u"Treatment request")
+ return _("Treatment request")
@classmethod
def get_query_owns(cls, ishtaruser):
@@ -1072,9 +1077,11 @@ class TreatmentFile(DashboardFormItem, ClosedItem, DocumentItem,
@property
def associated_filename(self):
- return "-".join([str(slugify(getattr(self, attr)))
- for attr in ('year', 'index', 'internal_reference',
- 'name') if getattr(self, attr)])
+ return "-".join(
+ str(slugify(getattr(self, attr)))
+ for attr in ('year', 'index', 'internal_reference', 'name')
+ if getattr(self, attr)
+ )
def get_extra_actions(self, request):
# url, base_text, icon, extra_text, extra css class, is a quick action
@@ -1082,8 +1089,8 @@ class TreatmentFile(DashboardFormItem, ClosedItem, DocumentItem,
if self.can_do(request, 'add_administrativeact'):
actions += [
(reverse('treatmentfile-add-adminact', args=[self.pk]),
- _(u"Add associated administrative act"), "fa fa-plus",
- _(u"admin. act"), "", False),
+ _("Add associated administrative act"), "fa fa-plus",
+ _("admin. act"), "", False),
]
if not self.associated_basket:
return actions
@@ -1095,7 +1102,7 @@ class TreatmentFile(DashboardFormItem, ClosedItem, DocumentItem,
if can_edit_find:
actions += [
(reverse('treatmentfile-add-treatment', args=[self.pk]),
- _(u"Add associated treatment"), "fa fa-flask", "", "",
+ _("Add associated treatment"), "fa fa-flask", "", "",
False),
]
return actions
@@ -1115,7 +1122,7 @@ class TreatmentFile(DashboardFormItem, ClosedItem, DocumentItem,
return settings.JOINT.join(items)
def _get_base_image_path(self,):
- return u"{}/{}/{}".format(self.SLUG, self.year, self.index)
+ return "{}/{}/{}".format(self.SLUG, self.year, self.index)
def pre_save(self):
# is not new
diff --git a/archaeological_finds/views.py b/archaeological_finds/views.py
index 8e90f901a..978afc759 100644
--- a/archaeological_finds/views.py
+++ b/archaeological_finds/views.py
@@ -251,7 +251,7 @@ get_find_basket_for_write = get_item(
basket_search_wizard = wizards.FindBasketSearch.as_view(
[('selec-find_basket_search', forms.FindBasketFormSelection)],
- label=_(u"Basket search"),
+ label=_("Basket search"),
url_name='find_basket_search',
)
@@ -262,7 +262,7 @@ basket_modify_wizard = wizards.FindBasketEditWizard.as_view(
('basket-find_basket_modification', forms.FindBasketForm),
('final-find_basket_modification', FinalForm)
],
- label=_(u"Basket modify"),
+ label=_("Basket modify"),
url_name='find_basket_modification',
)
@@ -287,7 +287,7 @@ findbasket_deletion_steps = [
basket_delete_wizard = wizards.FindBasketDeletionWizard.as_view(
findbasket_deletion_steps,
- label=_(u"Basket deletion"),
+ label=_("Basket deletion"),
url_name='find_basket_deletion',
)
@@ -318,7 +318,7 @@ find_creation_condition_dict = {
find_creation_wizard = wizards.FindWizard.as_view(
find_creation_steps,
- label=_(u"New find"),
+ label=_("New find"),
condition_dict=find_creation_condition_dict,
url_name='find_creation',)
@@ -330,7 +330,7 @@ find_search_condition_dict = {
find_search_wizard = wizards.FindSearch.as_view([
('general-find_search', forms.FindFormSelection),
('generalwarehouse-find_search', forms.FindFormSelectionWarehouseModule)],
- label=_(u"Find search"),
+ label=_("Find search"),
url_name='find_search',
condition_dict=find_search_condition_dict
)
@@ -370,7 +370,7 @@ find_modification_steps = [
find_modification_wizard = wizards.FindModificationWizard.as_view(
find_modification_steps,
condition_dict=find_modification_condition_dict,
- label=_(u"Find modification"),
+ label=_("Find modification"),
url_name='find_modification'
)
@@ -407,7 +407,7 @@ find_deletion_steps = [
find_deletion_wizard = wizards.FindDeletionWizard.as_view(
find_deletion_steps,
condition_dict=find_deletion_condition_dict,
- label=_(u"Find deletion"),
+ label=_("Find deletion"),
url_name='find_deletion',)
@@ -437,7 +437,7 @@ class NewFindBasketView(IshtarMixin, LoginRequiredMixin, CreateView):
template_name = 'ishtar/form.html'
model = models.FindBasket
form_class = forms.NewFindBasketForm
- page_name = _(u"New basket")
+ page_name = _("New basket")
def get_form_kwargs(self):
kwargs = super(NewFindBasketView, self).get_form_kwargs()
@@ -466,7 +466,7 @@ class OwnBasket(object):
class SelectBasketForManagement(IshtarMixin, LoginRequiredMixin, FormView):
template_name = 'ishtar/form.html'
form_class = forms.SelectFindBasketWriteForm
- page_name = _(u"Manage items in basket")
+ page_name = _("Manage items in basket")
def get_form_kwargs(self):
kwargs = super(SelectBasketForManagement, self).get_form_kwargs()
@@ -487,7 +487,7 @@ class SelectBasketForManagement(IshtarMixin, LoginRequiredMixin, FormView):
class SelectItemsInBasket(OwnBasket, IshtarMixin, LoginRequiredMixin,
TemplateView):
template_name = 'ishtar/manage_basket.html'
- page_name = _(u"Manage basket")
+ page_name = _("Manage basket")
def get_context_data(self, *args, **kwargs):
context = super(SelectItemsInBasket, self).get_context_data(
@@ -587,12 +587,12 @@ treatment_wizard_steps = [
treatment_search_wizard = wizards.TreatmentSearch.as_view([
('general-treatment_search', forms.TreatmentFormSelection)],
- label=_(u"Treatment search"),
+ label=_("Treatment search"),
url_name='treatment_search',)
treatment_creation_wizard = wizards.TreatmentWizard.as_view(
treatment_wizard_steps,
- label=_(u"New treatment"),
+ label=_("New treatment"),
url_name='treatment_creation',)
treatment_n1_wizard_steps = [
@@ -605,7 +605,7 @@ treatment_n1_wizard_steps = [
treatment_creation_n1_wizard = wizards.TreatmentN1Wizard.as_view(
treatment_n1_wizard_steps,
- label=_(u"New treatment"),
+ label=_("New treatment"),
url_name='treatment_creation_n1',)
treatment_1n_wizard_steps = [
@@ -618,7 +618,7 @@ treatment_1n_wizard_steps = [
treatment_creation_1n_wizard = wizards.Treatment1NWizard.as_view(
treatment_1n_wizard_steps,
- label=_(u"New treatment"),
+ label=_("New treatment"),
url_name='treatment_creation_1n',)
treatment_modification_wizard = wizards.TreatmentModificationWizard.as_view(
@@ -626,7 +626,7 @@ treatment_modification_wizard = wizards.TreatmentModificationWizard.as_view(
('file-treatment_modification', forms.TreatmentFormFileChoice),
('basetreatment-treatment_modification', forms.TreatmentModifyForm),
('final-treatment_modification', FinalForm)],
- label=_(u"Treatment modification"),
+ label=_("Treatment modification"),
url_name='treatment_modification',
)
@@ -665,10 +665,13 @@ def treatment_add(request, pks, treatment_file=None):
"person": in_charge.pk,
}
locas = list(
- set([str(f.container.location.pk)
- for f in treatment_file.associated_basket.items.all()
- if f.container and f.container.location])
+ {
+ str(f.container.location.pk)
+ for f in treatment_file.associated_basket.items.all()
+ if f.container and f.container.location
+ }
)
+
if len(locas) == 1: # one and only one location for all finds
dct["location"] = locas[0]
for k in dct:
@@ -703,10 +706,13 @@ def divide_treatment_add(request, pks, treatment_file=None):
"person": in_charge.pk,
}
locas = list(
- set([str(f.container.location.pk)
- for f in treatment_file.associated_basket.items.all()
- if f.container and f.container.location])
+ {
+ str(f.container.location.pk)
+ for f in treatment_file.associated_basket.items.all()
+ if f.container and f.container.location
+ }
)
+
if len(locas) == 1: # one and only one location for all finds
dct["location"] = locas[0]
for k in dct:
@@ -734,8 +740,7 @@ def findbasket_treatment_add(request, pk, current_right=None):
basket = models.FindBasket.objects.get(pk=pk)
except models.FindBasket.DoesNotExist:
raise Http404()
- return treatment_add(
- request, ",".join([str(f.pk) for f in basket.items.all()]))
+ return treatment_add(request, ",".join(str(f.pk) for f in basket.items.all()))
def findbasket_treatmentfile_add(request, pk, current_right=None):
@@ -751,8 +756,7 @@ def container_treatment_add(request, pk, current_right=None):
basket = models.FindBasket.objects.get(pk=pk)
except models.FindBasket.DoesNotExist:
raise Http404()
- return treatment_add(request,
- ",".join([str(f.pk) for f in basket.items.all()]))
+ return treatment_add(request, ",".join(str(f.pk) for f in basket.items.all()))
def treatmentfile_treatment_add(request, pk, current_right=None):
@@ -764,15 +768,16 @@ def treatmentfile_treatment_add(request, pk, current_right=None):
raise Http404()
basket = tf.associated_basket
return treatment_add(
- request, ",".join([str(f.pk) for f in basket.items.all()]),
- treatment_file=tf
+ request,
+ ",".join(str(f.pk) for f in basket.items.all()),
+ treatment_file=tf,
)
treatment_deletion_wizard = wizards.TreatmentDeletionWizard.as_view([
('selec-treatment_deletion', forms.TreatmentFormSelection),
('final-treatment_deletion', forms.TreatmentDeletionForm)],
- label=_(u"Treatment deletion"),
+ label=_("Treatment deletion"),
url_name='treatment_deletion',)
@@ -791,7 +796,7 @@ treatment_administrativeact_search_wizard = \
wizards.SearchWizard.as_view([
('selec-treatment_admacttreatment_search',
forms.AdministrativeActTreatmentFormSelection)],
- label=_(u"Treatment: search administrative act"),
+ label=_("Treatment: search administrative act"),
url_name='treatment_admacttreatment_search',)
treatment_administrativeact_wizard = \
@@ -800,7 +805,7 @@ treatment_administrativeact_wizard = \
('administrativeact-treatment_admacttreatment',
forms.AdministrativeActTreatmentForm),
('final-treatment_admacttreatment', FinalForm)],
- label=_(u"Treatment: new administrative act"),
+ label=_("Treatment: new administrative act"),
url_name='treatment_admacttreatment',)
treatment_administrativeact_modification_wizard = \
@@ -810,7 +815,7 @@ treatment_administrativeact_modification_wizard = \
('administrativeact-treatment_admacttreatment_modification',
forms.AdministrativeActTreatmentModifForm),
('final-treatment_admacttreatment_modification', FinalForm)],
- label=_(u"Treatment: administrative act modification"),
+ label=_("Treatment: administrative act modification"),
url_name='treatment_admacttreatment_modification',)
@@ -836,7 +841,7 @@ treatment_admacttreatment_deletion_wizard = \
forms.AdministrativeActTreatmentFormSelection),
('final-treatment_admacttreatment_deletion',
FinalAdministrativeActDeleteForm)],
- label=_(u"Treatment: administrative act deletion"),
+ label=_("Treatment: administrative act deletion"),
url_name='treatment_admacttreatment_deletion',)
@@ -869,7 +874,7 @@ def treatment_adminact_add(request, pk, current_right=None):
treatmentfile_search_wizard = wizards.TreatmentFileSearch.as_view([
('general-treatmentfile_search', forms.TreatmentFileFormSelection)],
- label=_(u"Treatment request search"),
+ label=_("Treatment request search"),
url_name='treatmentfile_search',)
treatmentfile_wizard_steps = [
@@ -879,7 +884,7 @@ treatmentfile_wizard_steps = [
treatmentfile_creation_wizard = wizards.TreatmentFileWizard.as_view(
treatmentfile_wizard_steps,
- label=_(u"New treatment request"),
+ label=_("New treatment request"),
url_name='treatmentfile_creation',)
treatmentfile_modification_wizard = \
@@ -888,7 +893,7 @@ treatmentfile_modification_wizard = \
('treatmentfile-treatmentfile_modification',
forms.TreatmentFileModifyForm),
('final-treatmentfile_modification', FinalForm)],
- label=_(u"Treatment request modification"),
+ label=_("Treatment request modification"),
url_name='treatmentfile_modification',
)
@@ -918,7 +923,7 @@ def treatmentfile_add(request, basket_pk=None):
treatmentfile_deletion_wizard = wizards.TreatmentFileDeletionWizard.as_view([
('selec-treatmentfile_deletion', forms.TreatmentFileFormSelectionMultiple),
('final-treatmentfile_deletion', forms.TreatmentFileDeletionForm)],
- label=_(u"Treatment request deletion"),
+ label=_("Treatment request deletion"),
url_name='treatmentfile_deletion',)
@@ -937,7 +942,7 @@ treatmentfile_admacttreatmentfile_search_wizard = \
wizards.SearchWizard.as_view([
('selec-treatmentfle_admacttreatmentfle_search',
forms.AdministrativeActTreatmentFileFormSelection)],
- label=_(u"Treatment request: search administrative act"),
+ label=_("Treatment request: search administrative act"),
url_name='treatmentfle_admacttreatmentfle_search',)
@@ -948,7 +953,7 @@ treatmentfile_admacttreatmentfile_wizard = \
('admact-treatmentfle_admacttreatmentfle',
forms.AdministrativeActTreatmentFileForm),
('final-treatmentfle_admacttreatmentfle', FinalForm)],
- label=_(u"Treatment request: new administrative act"),
+ label=_("Treatment request: new administrative act"),
url_name='treatmentfle_admacttreatmentfle',)
treatmentfile_admacttreatmentfile_modification_wizard = \
@@ -958,7 +963,7 @@ treatmentfile_admacttreatmentfile_modification_wizard = \
('admact-treatmentfle_admacttreatmentfle_modification',
forms.AdministrativeActTreatmentFileModifForm),
('final-treatmentfle_admacttreatmentfle_modification', FinalForm)],
- label=_(u"Treatment request: administrative act modification"),
+ label=_("Treatment request: administrative act modification"),
url_name='treatmentfle_admacttreatmentfle_modification',)
@@ -1000,7 +1005,7 @@ treatmentfile_admacttreatmentfile_deletion_wizard = \
forms.AdministrativeActTreatmentFileFormSelection),
('final-treatmentfle_admacttreatmentfle_deletion',
FinalAdministrativeActDeleteForm)],
- label=_(u"Treatment request: administrative act deletion"),
+ label=_("Treatment request: administrative act deletion"),
url_name='treatmentfle_admacttreatmentfle_deletion',)
@@ -1055,7 +1060,7 @@ class QAFindBasketFormView(QAItemForm):
template_name = 'ishtar/forms/qa_find_basket.html'
model = models.Find
form_class = forms.QAFindBasketForm
- page_name = _(u"Basket")
+ page_name = _("Basket")
modal_size = "small"
base_url = "find-qa-basket"
@@ -1072,7 +1077,7 @@ class QAFindBasketFormView(QAItemForm):
class QAFindDuplicateFormView(QAItemForm):
template_name = 'ishtar/forms/qa_find_duplicate.html'
model = models.Find
- page_name = _(u"Duplicate")
+ page_name = _("Duplicate")
form_class = forms.QAFindDuplicateForm
base_url = "find-qa-duplicate"
@@ -1088,7 +1093,7 @@ class QAFindDuplicateFormView(QAItemForm):
def get_context_data(self, **kwargs):
data = super(QAFindDuplicateFormView, self).get_context_data(
**kwargs)
- data['action_name'] = _(u"Duplicate")
+ data['action_name'] = _("Duplicate")
bf = self.items[0].get_first_base_find()
if bf:
data['context_record'] = bf.context_record
@@ -1100,7 +1105,7 @@ class QAFindTreatmentFormView(QAItemForm):
template_name = 'ishtar/forms/qa_find_treatment.html'
model = models.Find
form_class = forms.QAFindTreatmentForm
- page_name = _(u"Packaging")
+ page_name = _("Packaging")
base_url = "find-qa-packaging"
def dispatch(self, request, *args, **kwargs):
@@ -1125,7 +1130,7 @@ class QAFindTreatmentFormView(QAItemForm):
class QAFindbasketDuplicateFormView(QAItemForm):
template_name = 'ishtar/forms/qa_findbasket_duplicate.html'
model = models.FindBasket
- page_name = _(u"Duplicate")
+ page_name = _("Duplicate")
modal_size = "small"
form_class = forms.QAFindbasketDuplicateForm
base_url = "findbasket-qa-duplicate"
@@ -1142,7 +1147,7 @@ class QAFindbasketDuplicateFormView(QAItemForm):
def get_context_data(self, **kwargs):
data = super(QAFindbasketDuplicateFormView, self).get_context_data(
**kwargs)
- data['action_name'] = _(u"Duplicate")
+ data['action_name'] = _("Duplicate")
return data
@@ -1168,8 +1173,10 @@ class PublicFindAPI(APIView):
q = models.FindBasket.items.through.objects.filter(
findbasket_id=basket.id).values("find_id").order_by("id")
id_list = [bi["find_id"] for bi in q]
- clauses = ' '.join(['WHEN id=%s THEN %s' % (pk, i)
- for i, pk in enumerate(id_list)])
+ clauses = ' '.join(
+ 'WHEN id=%s THEN %s' % (pk, i) for i, pk in enumerate(id_list)
+ )
+
ordering = 'CASE {} END'.format(clauses)
return models.Find.objects.filter(id__in=id_list).extra(
select={'ordering': ordering}, order_by=('ordering',))
diff --git a/archaeological_finds/wizards.py b/archaeological_finds/wizards.py
index d58ac411b..d49529bf8 100644
--- a/archaeological_finds/wizards.py
+++ b/archaeological_finds/wizards.py
@@ -48,8 +48,7 @@ class FindWizard(Wizard):
main_form_key = 'selecrecord-' + self.url_name
try:
idx = int(self.session_get_value(main_form_key, 'pk'))
- current_cr = ContextRecord.objects.get(pk=idx)
- return current_cr
+ return ContextRecord.objects.get(pk=idx)
except(TypeError, ValueError, ObjectDoesNotExist):
pass
current_item = self.get_current_object()
@@ -84,8 +83,8 @@ class FindWizard(Wizard):
if not current_cr or self.steps.current.startswith('select-'):
return context
context['reminders'] = (
- (_(u"Operation"), str(current_cr.operation)),
- (_(u"Context record"), str(current_cr)))
+ (_("Operation"), str(current_cr.operation)),
+ (_("Context record"), str(current_cr)))
return context
def get_extra_model(self, dct, m2m, form_list):
@@ -140,7 +139,7 @@ class TreatmentBase(Wizard):
try:
return [
models.Find.objects.get(pk=int(find_id.strip()))
- for find_id in find_ids.split(u',')
+ for find_id in find_ids.split(',')
]
except(TypeError, ValueError, AttributeError, ObjectDoesNotExist):
pass
@@ -197,7 +196,7 @@ class TreatmentWizard(TreatmentBase):
if isinstance(pks, models.Find):
pks = [pks]
if not isinstance(pks, (list, tuple)):
- pks = str(pks).split(u',')
+ pks = str(pks).split(',')
for pk in pks:
if isinstance(pk, models.Find):
@@ -374,8 +373,8 @@ class Treatment1NWizard(TreatmentBase):
if not finds:
return initial
lbl = finds[0].label
- initial['resultings_basket_name'] = str(_(u"Basket")) + u" - " + lbl
- initial['resultings_label'] = lbl + u"-"
+ initial['resultings_basket_name'] = str(_("Basket")) + " - " + lbl
+ initial['resultings_label'] = lbl + "-"
return initial
def get_extra_model(self, dct, m2m, form_list):
@@ -411,12 +410,12 @@ class Treatment1NWizard(TreatmentBase):
] = dct.pop(k)
messages.add_message(
self.request, messages.INFO,
- str(_(u"The new basket: \"{}\" have been created with the "
- u"resulting items. This search have been pinned.")
- ).format(dct["resulting_finds"]["basket_name"])
+ str(_("The new basket: \"{}\" have been created with the "
+ "resulting items. This search have been pinned.")
+ ).format(dct["resulting_finds"]["basket_name"])
)
- self.request.session["pin-search-find"] = u'{}="{}"'.format(
- str(pgettext("key for text search", u"basket")),
+ self.request.session["pin-search-find"] = '{}="{}"'.format(
+ str(pgettext("key for text search", "basket")),
dct["resulting_finds"]["basket_name"])
self.request.session['find'] = ''
return dct
@@ -487,7 +486,7 @@ class TreatmentFileAdministrativeActWizard(
pk = self.session_get_value(form_key, "pk")
try:
return (
- (_(u"Treatment request"),
+ (_("Treatment request"),
str(models.TreatmentFile.objects.get(pk=pk))),
)
except models.TreatmentFile.DoesNotExist:
@@ -499,7 +498,7 @@ class TreatmentFileAdministrativeActWizard(
if not admin.operation:
return
return (
- (_(u"Operation"), str(admin.operation)),
+ (_("Operation"), str(admin.operation)),
)
except AdministrativeAct.DoesNotExist:
return
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py
index b54a081d8..2d462c252 100644
--- a/archaeological_operations/forms.py
+++ b/archaeological_operations/forms.py
@@ -179,7 +179,7 @@ class ParcelForm(IshtarForm):
grouped = []
for keys, parcel_grp in groupby(parcels, key=sortkeyfn):
keys = list(keys)
- keys.append([u' '.join([str(gp[-2]), str(gp[-1])])
+ keys.append([' '.join([str(gp[-2]), str(gp[-1])])
for gp in parcel_grp])
grouped.append(keys)
res = ''
@@ -191,11 +191,11 @@ class ParcelForm(IshtarForm):
c_section = ''
if idx:
res += " ; "
- res += town + u' : '
+ res += town + ' : '
if c_section:
res += " / "
c_section = section
- res += section + u' '
+ res += section + ' '
res += ", ".join(parcel_numbers)
if year:
res += " (%s)" % str(year)
@@ -1825,7 +1825,7 @@ class GenerateDocForm(IshtarForm):
if 'choices' in kwargs:
choices = kwargs.pop('choices')
super(GenerateDocForm, self).__init__(*args, **kwargs)
- self.fields['doc_generation'].choices = [('', u'-' * 9)] + \
+ self.fields['doc_generation'].choices = [('', '-' * 9)] + \
[(choice.pk, str(choice)) for choice in choices]
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py
index 014d1071b..b7841450c 100644
--- a/archaeological_operations/models.py
+++ b/archaeological_operations/models.py
@@ -315,7 +315,7 @@ class ArchaeologicalSite(DocumentItem, BaseHistorizedItem, CompleteIdentifierIte
null=True, blank=True)
periods = models.ManyToManyField(Period, verbose_name=_("Periods"),
blank=True)
- remains = models.ManyToManyField("RemainType", verbose_name=_(u'Remains'),
+ remains = models.ManyToManyField("RemainType", verbose_name=_('Remains'),
blank=True)
cultural_attributions = models.ManyToManyField(
"CulturalAttributionType", verbose_name=_("Cultural attribution"),
@@ -1073,7 +1073,7 @@ class Operation(ClosedItem, DocumentItem, BaseHistorizedItem,
operation_type = models.ForeignKey(OperationType, related_name='+',
verbose_name=_("Operation type"))
surface = models.IntegerField(_("Surface (m2)"), blank=True, null=True)
- remains = models.ManyToManyField("RemainType", verbose_name=_(u'Remains'),
+ remains = models.ManyToManyField("RemainType", verbose_name=_('Remains'),
blank=True)
towns = models.ManyToManyField(Town, verbose_name=_("Towns"),
related_name='operations')
@@ -1887,10 +1887,10 @@ class OperationByDepartment(models.Model):
class ActType(GeneralType):
- TYPE = (('F', _(u'Archaeological file')),
- ('O', _(u'Operation')),
- ('TF', _(u'Treatment request')),
- ('T', _(u'Treatment')),
+ TYPE = (('F', _('Archaeological file')),
+ ('O', _('Operation')),
+ ('TF', _('Treatment request')),
+ ('T', _('Treatment')),
)
SERIALIZATION_EXCLUDE = ["associated_template"]
intented_to = models.CharField(_("Intended to"), max_length=2,
diff --git a/archaeological_operations/utils.py b/archaeological_operations/utils.py
index 55fb9ef76..bf38a675a 100644
--- a/archaeological_operations/utils.py
+++ b/archaeological_operations/utils.py
@@ -66,7 +66,7 @@ def _init_ope_types():
ot, created = OperationType.objects.get_or_create(
txt_idx=settings.ISHTAR_OPE_TYPES[k][0],
defaults={'label': settings.ISHTAR_OPE_TYPES[k][1],
- 'preventive': k[0] == u'préventive'})
+ 'preventive': k[0] == 'préventive'})
ope_types[k] = ot
@@ -109,8 +109,8 @@ def parse_period(value):
if not periods:
_init_period()
if not value:
- return [periods[u'']]
- period, old_val = [], u''
+ return [periods['']]
+ period, old_val = [], ''
while value and old_val != value:
old_val = value
for k in periods_keys:
@@ -133,8 +133,8 @@ def parse_period_name(value):
_init_period()
value = parse_string(value)
if not value:
- return [period_names[u'']]
- period, old_val = [], u''
+ return [period_names['']]
+ period, old_val = [], ''
value = slugify(value)
while value and old_val != value:
old_val = value
diff --git a/archaeological_operations/widgets.py b/archaeological_operations/widgets.py
index fa7306208..247fafba5 100644
--- a/archaeological_operations/widgets.py
+++ b/archaeological_operations/widgets.py
@@ -46,7 +46,7 @@ class ParcelWidget(widgets.MultiWidget):
return [None, None]
def format_output(self, rendered_widgets):
- return u' / '.join(rendered_widgets)
+ return ' / '.join(rendered_widgets)
class SelectParcelWidget(widgets.TextInput):
diff --git a/docs/old/source/conf.py b/docs/old/source/conf.py
index b10f0f783..37346a590 100644
--- a/docs/old/source/conf.py
+++ b/docs/old/source/conf.py
@@ -40,7 +40,7 @@ source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
-project = u'Ishtar'
+project = 'Ishtar'
copyright = u'2011, Étienne Loks'
# The version info for the project you're documenting, acts as replacement for
diff --git a/example_project/local_settings.py.sample b/example_project/local_settings.py.sample
index 555adb711..21e7cb791 100644
--- a/example_project/local_settings.py.sample
+++ b/example_project/local_settings.py.sample
@@ -50,7 +50,7 @@ ALLOWED_HOSTS = []
SRID = 27572
ENCODING = '' # specific encoding for CSV export - default to utf-8
SURFACE_UNIT = 'square-metre'
-SURFACE_UNIT_LABEL = u'm²'
+SURFACE_UNIT_LABEL = 'm²'
# translation overload can consume resources for a low profile machine
# USE_TRANSLATION_OVERLOAD = True
diff --git a/example_project/settings.py b/example_project/settings.py
index 07d5de200..7b9b8ee63 100644
--- a/example_project/settings.py
+++ b/example_project/settings.py
@@ -105,8 +105,8 @@ USE_I18N = True
# calendars according to the current locale
USE_L10N = True
LANGUAGES = (
- ('fr', u'Français'),
- ('en', u'English'),
+ ('fr', 'Français'),
+ ('en', 'English'),
)
DEFAULT_LANGUAGE = 1
diff --git a/ishtar_common/admin.py b/ishtar_common/admin.py
index cccc1f889..2fe0c012a 100644
--- a/ishtar_common/admin.py
+++ b/ishtar_common/admin.py
@@ -1149,7 +1149,7 @@ class ProfileTypeSummaryAdmin(admin.ModelAdmin):
groups = []
ok = mark_safe(
- u'<img src="{}admin/img/icon-yes.svg" alt="True">'.format(
+ '<img src="{}admin/img/icon-yes.svg" alt="True">'.format(
settings.STATIC_URL
))
for group in models.Group.objects.order_by("name"):
diff --git a/ishtar_common/forms.py b/ishtar_common/forms.py
index 74590c240..5b6501b13 100644
--- a/ishtar_common/forms.py
+++ b/ishtar_common/forms.py
@@ -89,7 +89,7 @@ def file_size_validator(value):
limit = (settings.MAX_UPLOAD_SIZE * 1024 * 1024) - 100
if value.size > limit:
raise ValidationError(
- str(_(u'File too large. Size should not exceed {} Mo.')).format(
+ str(_('File too large. Size should not exceed {} Mo.')).format(
settings.MAX_UPLOAD_SIZE
)
)
@@ -448,7 +448,7 @@ class MultiSearchForm(CustomFormSearch):
if not data or cls.pk_key not in data or not data[cls.pk_key]:
continue
pks = data[cls.pk_key]
- for pk in str(pks).split(u','):
+ for pk in str(pks).split(','):
if not pk:
continue
try:
@@ -1000,7 +1000,7 @@ def get_form_selection(
def get_data_from_formset(data):
"""
- convert ['formname-wizardname-1-public_domain': [u'on'], ...] to
+ convert ['formname-wizardname-1-public_domain': ['on'], ...] to
[{'public_domain': 'off'}, {'public_domain': 'on'}]
"""
values = []
diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py
index 7224620e0..22a9e0279 100644
--- a/ishtar_common/forms_common.py
+++ b/ishtar_common/forms_common.py
@@ -97,7 +97,7 @@ def get_person_field(label=_("Person"), required=True, person_types=[]):
person_types = [
str(models.PersonType.objects.get(txt_idx=person_type).pk)
for person_type in person_types]
- url += "/" + u'_'.join(person_types)
+ url += "/" + '_'.join(person_types)
widget = widgets.JQueryAutoComplete(url, associated_model=models.Person)
return forms.IntegerField(widget=widget, label=label, required=required,
validators=[models.valid_id(models.Person)])
diff --git a/ishtar_common/models_imports.py b/ishtar_common/models_imports.py
index b3b64bd65..7a8a10bc2 100644
--- a/ishtar_common/models_imports.py
+++ b/ishtar_common/models_imports.py
@@ -947,7 +947,7 @@ class Import(models.Model):
"will be used.")
)
encoding = models.CharField(_("Encoding"), choices=ENCODINGS,
- default=u'utf-8', max_length=15)
+ default='utf-8', max_length=15)
csv_sep = models.CharField(
_("CSV separator"), choices=CSV_SEPS, default=',', max_length=1,
help_text=_("Separator for CSV file. Standard is comma but Microsoft "
@@ -966,10 +966,10 @@ class Import(models.Model):
_("Match file"), upload_to="upload/imports/%Y/%m/", blank=True,
null=True, max_length=255, help_text=max_size_help())
state = models.CharField(_("State"), max_length=2, choices=IMPORT_STATE,
- default=u'C')
+ default='C')
conservative_import = models.BooleanField(
_("Conservative import"), default=False,
- help_text=_(u'If set to true, do not overload existing values.'))
+ help_text=_('If set to true, do not overload existing values.'))
creation_date = models.DateTimeField(
_("Creation date"), auto_now_add=True, blank=True, null=True)
end_date = models.DateTimeField(_("End date"), auto_now_add=True,
diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py
index 4356509e8..d6802ef77 100644
--- a/ishtar_common/tests.py
+++ b/ishtar_common/tests.py
@@ -2391,7 +2391,7 @@ class IshtarSiteProfileTest(TestCase):
def testExternalKey(self):
profile = models.get_current_profile()
- p = models.Person.objects.create(name='plouf', surname=u'Tégada')
+ p = models.Person.objects.create(name='plouf', surname='Tégada')
self.assertEqual(p.raw_name, "PLOUF Tégada")
profile.person_raw_name = '{surname|slug} {name}'
profile.save()
diff --git a/setup.py b/setup.py
index f197aea0a..8ed01c6f0 100644
--- a/setup.py
+++ b/setup.py
@@ -18,7 +18,7 @@ setup(
description="Ishtar is a database to manage the finds and "
"documentation from archaeological operations.",
long_description=open('README.rst').read(),
- author=u'Étienne Loks',
+ author='Étienne Loks',
author_email='etienne.loks@iggdrasil.net',
url='https://ishtar-archeo.net/',
license='AGPL v3 licence, see COPYING',