summaryrefslogtreecommitdiff
path: root/archaeological_operations
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_operations')
-rw-r--r--archaeological_operations/admin.py7
-rw-r--r--archaeological_operations/forms.py24
-rw-r--r--archaeological_operations/models.py35
-rw-r--r--archaeological_operations/templates/ishtar/sheet_operation.html3
4 files changed, 49 insertions, 20 deletions
diff --git a/archaeological_operations/admin.py b/archaeological_operations/admin.py
index e10c962ca..60a1bad3a 100644
--- a/archaeological_operations/admin.py
+++ b/archaeological_operations/admin.py
@@ -164,6 +164,13 @@ class RelationTypeAdmin(GeneralTypeAdmin):
admin_site.register(models.RelationType, RelationTypeAdmin)
+class RecordQualityTypeAdmin(GeneralTypeAdmin):
+ list_display = ['label', 'txt_idx', 'available', 'order', 'comment']
+
+
+admin_site.register(models.RecordQualityType, RecordQualityTypeAdmin)
+
+
class ActTypeAdmin(GeneralTypeAdmin):
list_filter = ('intented_to',)
list_display = ['label', 'txt_idx', 'available', 'intented_to']
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py
index 20379e588..af4e21e31 100644
--- a/archaeological_operations/forms.py
+++ b/archaeological_operations/forms.py
@@ -739,13 +739,15 @@ class OperationFormGeneral(CustomForm, ManageOldType):
form_slug = "operation-010-general"
file_upload = True
- associated_models = {'scientist': Person,
- 'in_charge': Person,
- 'cira_rapporteur': Person,
- 'operator': Organization,
- 'operation_type': models.OperationType,
- 'report_processing': models.ReportState,
- }
+ associated_models = {
+ 'scientist': Person,
+ 'in_charge': Person,
+ 'cira_rapporteur': Person,
+ 'operator': Organization,
+ 'operation_type': models.OperationType,
+ 'record_quality_type': models.RecordQualityType,
+ 'report_processing': models.ReportState
+ }
pk = forms.IntegerField(required=False, widget=forms.HiddenInput)
if settings.COUNTRY == 'fr':
code_patriarche = forms.CharField(label=u"Code PATRIARCHE",
@@ -841,8 +843,8 @@ class OperationFormGeneral(CustomForm, ManageOldType):
scientific_documentation_comment = forms.CharField(
label=_(u"Comment about scientific documentation"),
widget=forms.Textarea, required=False)
- record_quality = forms.ChoiceField(label=_(u"Record quality"),
- required=False)
+ record_quality_type = forms.ChoiceField(label=_(u"Record quality"),
+ required=False)
virtual_operation = forms.BooleanField(required=False,
label=_(u"Virtual operation"))
@@ -861,6 +863,7 @@ class OperationFormGeneral(CustomForm, ManageOldType):
]
TYPES = [
FieldType('operation_type', models.OperationType),
+ FieldType('record_quality_type', models.RecordQualityType),
FieldType('report_processing', models.ReportState),
]
@@ -873,9 +876,6 @@ class OperationFormGeneral(CustomForm, ManageOldType):
if not profile.warehouse:
for key in self.WAREHOUSE_FIELDS:
self.remove_field(key)
- if 'record_quality' in self.fields:
- self.fields['record_quality'].choices = \
- [('', '--')] + list(models.QUALITY)
def clean(self):
cleaned_data = self.cleaned_data
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py
index 035235b51..f09184a32 100644
--- a/archaeological_operations/models.py
+++ b/archaeological_operations/models.py
@@ -101,12 +101,21 @@ class ArchaeologicalSite(BaseHistorizedItem):
SHOW_URL = 'show-site'
TABLE_COLS = ['reference', 'name', 'towns', 'periods', 'remains']
SLUG = 'site'
+
BASE_SEARCH_VECTORS = [
- "reference", "name", "oceanographic_service_localisation",
- "shipwreck_code", "comment", "shipwreck_name", "discovery_area",
+ "comment",
+ "discovery_area",
+ "locality_cadastral",
+ "locality_ngi",
+ "name",
+ "oceanographic_service_localisation",
+ "reference",
+ "shipwreck_code",
+ "shipwreck_name",
]
M2M_SEARCH_VECTORS = ["periods__label", "remains__label", "towns__name"]
PARENT_SEARCH_VECTORS = ['operations']
+
reference = models.CharField(_(u"Reference"), max_length=200, unique=True)
name = models.CharField(_(u"Name"), max_length=200,
null=True, blank=True)
@@ -354,12 +363,26 @@ class Operation(ClosedItem, BaseHistorizedItem, OwnPerms, ValueGetter,
u"reference)"),
}
BASE_SEARCH_VECTORS = [
- "scientist__raw_name", "cached_label", "common_name", "comment",
- "address", "old_code", "seizure_name", "official_report_number",
- "name_of_the_protagonist"
+ "abstract",
+ "address",
+ "code_patriarche",
+ "comment",
+ "common_name",
+ "in_charge__cached_label",
+ "name_of_the_protagonist",
+ "official_report_number",
+ "old_code",
+ "operation_type__label",
+ "operator_reference",
+ "operator__cached_label",
+ "scientist__cached_label",
+ "scientific_documentation_comment",
+ "seizure_name",
]
INT_SEARCH_VECTORS = ["year"]
- M2M_SEARCH_VECTORS = ["towns__name"]
+ M2M_SEARCH_VECTORS = ["periods__label", "remains__label", "towns__name"]
+ PARENT_SEARCH_VECTORS = ["associated_file"]
+ PARENT_ONLY_SEARCH_VECTORS = ["archaeological_sites"]
ASSOCIATED = {
"scientist": {
('person_types', PersonType): (
diff --git a/archaeological_operations/templates/ishtar/sheet_operation.html b/archaeological_operations/templates/ishtar/sheet_operation.html
index 231db2ae8..91c1501ec 100644
--- a/archaeological_operations/templates/ishtar/sheet_operation.html
+++ b/archaeological_operations/templates/ishtar/sheet_operation.html
@@ -87,8 +87,7 @@
{%endif%}
{% field_flex_multiple "Remains" item.remains %}
{% field_flex_multiple "Periods" item.periods %}
- {% if item.QUALITY_DICT %}{% field_flex "Record quality" item.record_quality|from_dict:item.QUALITY_DICT %}{% endif %}
- {% if item.history_object and item.history_object.QUALITY_DICT %}{% field_flex "Record quality" item.record_quality|from_dict:item.history_object.QUALITY_DICT %}{% endif %}
+ {% field_flex "Record quality" item.record_quality_type %}
{% field_flex "Report delivery date" item.report_delivery_date %}
{% field_flex "Report processing" item.report_processing %}
{% field_flex "Deadline for submission of the documentation" item.documentation_deadline %}