summaryrefslogtreecommitdiff
path: root/archaeological_finds
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_finds')
-rw-r--r--archaeological_finds/forms.py14
-rw-r--r--archaeological_finds/forms_treatments.py4
-rw-r--r--archaeological_finds/ishtar_menu.py32
-rw-r--r--archaeological_finds/locale/django.pot509
-rw-r--r--archaeological_finds/models_finds.py101
-rw-r--r--archaeological_finds/models_treatments.py65
-rw-r--r--archaeological_finds/templates/ishtar/sheet_find.html10
-rw-r--r--archaeological_finds/templates/ishtar/sheet_findbasket.html2
-rw-r--r--archaeological_finds/tests.py22
-rw-r--r--archaeological_finds/urls.py4
-rw-r--r--archaeological_finds/views.py2
11 files changed, 492 insertions, 273 deletions
diff --git a/archaeological_finds/forms.py b/archaeological_finds/forms.py
index 09d23a3bc..8fe945e88 100644
--- a/archaeological_finds/forms.py
+++ b/archaeological_finds/forms.py
@@ -147,18 +147,22 @@ class FindForm(ManageOldType, forms.Form):
required=False)
is_complete = forms.NullBooleanField(label=_(u"Is complete?"),
required=False)
- material_type = widgets.MultipleAutocompleteField(
- model=models.MaterialType, label=_(u"Material type"), required=False)
+ material_type = widgets.Select2MultipleField(
+ model=models.MaterialType, label=_(u"Material type"), required=False,
+ available=True
+ )
conservatory_state = forms.ChoiceField(label=_(u"Conservatory state"),
choices=[], required=False)
conservatory_comment = forms.CharField(
label=_(u"Conservatory comment"), required=False,
widget=forms.Textarea)
- object_type = widgets.MultipleAutocompleteField(
- model=models.ObjectType, label=_(u"Object types"), required=False)
+ object_type = widgets.Select2MultipleField(
+ model=models.ObjectType, label=_(u"Object types"), required=False,
+ available=True
+ )
preservation_to_consider = forms.MultipleChoiceField(
label=_(u"Preservation type"), choices=[],
- widget=widgets.CheckboxSelectMultiple, required=False)
+ widget=widgets.Select2Multiple, required=False)
integritie = forms.MultipleChoiceField(
label=_(u"Integrity / interest"), choices=[],
widget=widgets.CheckboxSelectMultiple, required=False)
diff --git a/archaeological_finds/forms_treatments.py b/archaeological_finds/forms_treatments.py
index 3c6668c9d..b3ad8b115 100644
--- a/archaeological_finds/forms_treatments.py
+++ b/archaeological_finds/forms_treatments.py
@@ -95,7 +95,7 @@ class BaseTreatmentForm(ManageOldType, forms.Form):
label=_(u"Other ref."), max_length=200, required=False)
year = forms.IntegerField(label=_("Year"),
initial=lambda: datetime.datetime.now().year,
- validators=[validators.MinValueValidator(1900),
+ validators=[validators.MinValueValidator(1600),
validators.MaxValueValidator(2100)])
treatment_type = forms.MultipleChoiceField(
label=_(u"Treatment type"), choices=[],
@@ -405,7 +405,7 @@ class TreatmentFileForm(ManageOldType, forms.Form):
max_length=1000, required=False)
year = forms.IntegerField(label=_("Year"),
initial=lambda: datetime.datetime.now().year,
- validators=[validators.MinValueValidator(1900),
+ validators=[validators.MinValueValidator(1600),
validators.MaxValueValidator(2100)])
internal_reference = forms.CharField(
label=_(u"Internal ref."), max_length=60, required=False)
diff --git a/archaeological_finds/ishtar_menu.py b/archaeological_finds/ishtar_menu.py
index 44a19dc02..4877e442c 100644
--- a/archaeological_finds/ishtar_menu.py
+++ b/archaeological_finds/ishtar_menu.py
@@ -112,23 +112,23 @@ MENU_SECTIONS = [
MenuItem('treatmentfle_search',
_(u"Search"),
model=models.TreatmentFile,
- access_controls=['view_find',
- 'view_own_find']),
+ access_controls=['view_treatmentfile',
+ 'view_own_treatmentfile']),
MenuItem('treatmentfle_creation',
_(u"Creation"),
model=models.TreatmentFile,
- access_controls=['change_find',
- 'change_own_find']),
+ access_controls=['change_treatmentfile',
+ 'change_own_treatmentfile']),
MenuItem('treatmentfle_modification',
_(u"Modification"),
model=models.TreatmentFile,
- access_controls=['change_find',
- 'change_own_find']),
+ access_controls=['change_treatmentfile',
+ 'change_own_treatmentfile']),
MenuItem('treatmentfle_deletion',
_(u"Deletion"),
model=models.TreatmentFile,
- access_controls=['change_find',
- 'change_own_find']),
+ access_controls=['change_treatmentfile',
+ 'change_own_treatmentfile']),
SectionItem(
'admin_act_fletreatments', _(u"Administrative act"),
childs=[
@@ -192,23 +192,23 @@ MENU_SECTIONS = [
MenuItem('treatment_search',
_(u"Search"),
model=models.Treatment,
- access_controls=['view_find',
- 'view_own_find']),
+ access_controls=['view_treatment',
+ 'view_own_treatment']),
MenuItem('treatment_creation',
_(u"Creation"),
model=models.Treatment,
- access_controls=['change_find',
- 'change_own_find']),
+ access_controls=['change_treatment',
+ 'change_own_treatment']),
MenuItem('treatment_modification',
_(u"Modification"),
model=models.Treatment,
- access_controls=['change_find',
- 'change_own_find']),
+ access_controls=['change_treatment',
+ 'change_own_treatment']),
MenuItem('treatment_deletion',
_(u"Deletion"),
model=models.Treatment,
- access_controls=['change_find',
- 'change_own_find']),
+ access_controls=['change_treatment',
+ 'change_own_treatment']),
]),
SectionItem(
'admin_act_treatments', _(u"Administrative act"),
diff --git a/archaeological_finds/locale/django.pot b/archaeological_finds/locale/django.pot
index d48cbe962..5947def9d 100644
--- a/archaeological_finds/locale/django.pot
+++ b/archaeological_finds/locale/django.pot
@@ -5,370 +5,371 @@
# Valérie-Emma Leroux <emma@iggdrasil.net>, 2016. #zanata
# Étienne Loks <etienne.loks@iggdrasil.net>, 2016. #zanata
# Valérie-Emma Leroux <emma@iggdrasil.net>, 2017. #zanata
+# Étienne Loks <etienne.loks@iggdrasil.net>, 2017. #zanata
msgid ""
msgstr ""
-#: forms.py:93 forms.py:97 models_finds.py:505 wizards.py:64
+#: forms.py:93 forms.py:97 models_finds.py:519 wizards.py:64
msgid "Context record"
msgstr ""
-#: forms.py:126 ishtar_menu.py:32 models_finds.py:668 models_finds.py:1071
-#: models_finds.py:1080 models_treatments.py:281
+#: forms.py:126 ishtar_menu.py:32 models_finds.py:683 models_finds.py:1114
+#: models_finds.py:1135 models_treatments.py:298
#: templates/ishtar/sheet_find.html:5
msgid "Find"
msgstr ""
-#: forms.py:140 forms.py:333 forms.py:601 models_finds.py:151
-#: models_finds.py:599
+#: forms.py:140 forms.py:337 forms.py:605 models_finds.py:150
+#: models_finds.py:613
msgid "Free ID"
msgstr ""
-#: forms.py:142 models_finds.py:651
+#: forms.py:142 models_finds.py:666
msgid "Previous ID"
msgstr ""
-#: forms.py:143 forms.py:364 forms_treatments.py:134 models_finds.py:155
-#: models_finds.py:600 models_treatments.py:127
+#: forms.py:143 forms.py:368 forms_treatments.py:134 models_finds.py:154
+#: models_finds.py:614 models_treatments.py:128
msgid "Description"
msgstr ""
-#: forms.py:146 forms.py:366 models_finds.py:164
+#: forms.py:146 forms.py:370 models_finds.py:163
msgid "Batch/object"
msgstr ""
-#: forms.py:148 models_finds.py:628
+#: forms.py:148 models_finds.py:643
msgid "Is complete?"
msgstr ""
-#: forms.py:151 forms.py:354 forms.py:605 models_finds.py:51
+#: forms.py:151 forms.py:358 forms.py:609 models_finds.py:50
msgid "Material type"
msgstr ""
-#: forms.py:152 forms.py:358 models_finds.py:63 models_finds.py:604
+#: forms.py:154 forms.py:362 models_finds.py:62 models_finds.py:618
msgid "Conservatory state"
msgstr ""
-#: forms.py:155 models_finds.py:606
+#: forms.py:157 models_finds.py:620
msgid "Conservatory comment"
msgstr ""
-#: forms.py:158 models_finds.py:113 models_finds.py:631
+#: forms.py:160 models_finds.py:112 models_finds.py:646
msgid "Object types"
msgstr ""
-#: forms.py:160 forms.py:357 models_finds.py:72
+#: forms.py:164 forms.py:361 models_finds.py:71
msgid "Preservation type"
msgstr ""
-#: forms.py:163 forms.py:360 models_finds.py:633
+#: forms.py:167 forms.py:364 models_finds.py:648
msgid "Integrity / interest"
msgstr ""
-#: forms.py:166 forms.py:362 models_finds.py:636
+#: forms.py:170 forms.py:366 models_finds.py:651
msgid "Remarkability"
msgstr ""
-#: forms.py:169 models_finds.py:169
+#: forms.py:173 models_finds.py:168
msgid "Point of topographic reference"
msgstr ""
-#: forms.py:172 models_finds.py:171
+#: forms.py:176 models_finds.py:170
msgid "X"
msgstr ""
-#: forms.py:173 models_finds.py:172
+#: forms.py:177 models_finds.py:171
msgid "Y"
msgstr ""
-#: forms.py:174 models_finds.py:173
+#: forms.py:178 models_finds.py:172
msgid "Z"
msgstr ""
-#: forms.py:176 models_finds.py:181
+#: forms.py:180 models_finds.py:180
msgid "Spatial Reference System"
msgstr ""
-#: forms.py:179 models_finds.py:174
+#: forms.py:183 models_finds.py:173
msgid "Estimated error for X"
msgstr ""
-#: forms.py:181 models_finds.py:176
+#: forms.py:185 models_finds.py:175
msgid "Estimated error for Y"
msgstr ""
-#: forms.py:183 models_finds.py:178
+#: forms.py:187 models_finds.py:177
msgid "Estimated error for Z"
msgstr ""
-#: forms.py:184 models_finds.py:640
+#: forms.py:188 models_finds.py:655
msgid "Length (cm)"
msgstr ""
-#: forms.py:185 models_finds.py:641
+#: forms.py:189 models_finds.py:656
msgid "Width (cm)"
msgstr ""
-#: forms.py:186 models_finds.py:642
+#: forms.py:190 models_finds.py:657
msgid "Height (cm)"
msgstr ""
-#: forms.py:187 models_finds.py:643
+#: forms.py:191 models_finds.py:658
msgid "Diameter (cm)"
msgstr ""
-#: forms.py:188 models_finds.py:644
+#: forms.py:192 models_finds.py:659
msgid "Thickness (cm)"
msgstr ""
-#: forms.py:189 forms.py:606 models_finds.py:611
+#: forms.py:193 forms.py:610 models_finds.py:625
msgid "Volume (l)"
msgstr ""
-#: forms.py:190 forms.py:607 models_finds.py:612
+#: forms.py:194 forms.py:611 models_finds.py:626
msgid "Weight (g)"
msgstr ""
-#: forms.py:192 models_finds.py:645
+#: forms.py:196 models_finds.py:660
msgid "Dimensions comment"
msgstr ""
-#: forms.py:193 forms.py:608 models_finds.py:615
+#: forms.py:197 forms.py:612 models_finds.py:629
msgid "Find number"
msgstr ""
-#: forms.py:195 models_finds.py:639
+#: forms.py:199 models_finds.py:654
msgid "Minimum number of individuals (MNI)"
msgstr ""
-#: forms.py:196 models_finds.py:647
+#: forms.py:200 models_finds.py:662
msgid "Mark"
msgstr ""
-#: forms.py:197 forms.py:367 models_finds.py:653
+#: forms.py:201 forms.py:371 models_finds.py:668
msgid "Check"
msgstr ""
-#: forms.py:199 models_finds.py:655
+#: forms.py:203 models_finds.py:670
msgid "Check date"
msgstr ""
-#: forms.py:200 forms_treatments.py:132 forms_treatments.py:434
-#: models_finds.py:156 models_finds.py:648 models_treatments.py:126
-#: models_treatments.py:494
+#: forms.py:204 forms_treatments.py:132 forms_treatments.py:434
+#: models_finds.py:155 models_finds.py:663 models_treatments.py:127
+#: models_treatments.py:511
msgid "Comment"
msgstr ""
-#: forms.py:203 models_finds.py:649
+#: forms.py:207 models_finds.py:664
msgid "Comment on dating"
msgstr ""
-#: forms.py:204 models_finds.py:657
+#: forms.py:208 models_finds.py:672
msgid "Estimated value"
msgstr ""
-#: forms.py:206 forms_treatments.py:151
+#: forms.py:210 forms_treatments.py:151
msgid "Image"
msgstr ""
-#: forms.py:207 forms_treatments.py:152
+#: forms.py:211 forms_treatments.py:152
#, python-format
msgid ""
"<p>Heavy images are resized to: %(width)dx%(height)d (ratio is preserved).</"
"p>"
msgstr ""
-#: forms.py:281
+#: forms.py:285
msgid "You should at least provide X, Y and the spatial reference system used."
msgstr ""
-#: forms.py:290
+#: forms.py:294
msgid "Coordinates are not relevant for the spatial reference system used: {}."
msgstr ""
-#: forms.py:296 forms.py:327 models_finds.py:623
+#: forms.py:300 forms.py:331 models_finds.py:637
msgid "Dating"
msgstr ""
-#: forms.py:301 forms.py:353
+#: forms.py:305 forms.py:357
msgid "Period"
msgstr ""
-#: forms.py:302 forms_treatments.py:138 forms_treatments.py:436
-#: models_finds.py:1085 models_treatments.py:129 models_treatments.py:292
+#: forms.py:306 forms_treatments.py:138 forms_treatments.py:436
+#: models_finds.py:1140 models_treatments.py:130 models_treatments.py:309
#: templates/ishtar/sheet_find.html:91 templates/ishtar/sheet_find.html:133
msgid "Start date"
msgstr ""
-#: forms.py:304 models_finds.py:1086 models_treatments.py:293
+#: forms.py:308 models_finds.py:1141 models_treatments.py:310
#: templates/ishtar/sheet_find.html:92 templates/ishtar/sheet_find.html:134
msgid "End date"
msgstr ""
-#: forms.py:305
+#: forms.py:309
msgid "Quality"
msgstr ""
-#: forms.py:307
+#: forms.py:311
msgid "Dating type"
msgstr ""
-#: forms.py:309
+#: forms.py:313
msgid "Precise dating"
msgstr ""
-#: forms.py:331 models_finds.py:188
+#: forms.py:335 models_finds.py:187
msgid "Short ID"
msgstr ""
-#: forms.py:332 models_finds.py:191
+#: forms.py:336 models_finds.py:190
msgid "Complete ID"
msgstr ""
-#: forms.py:336 forms_treatments.py:54 forms_treatments.py:96
+#: forms.py:340 forms_treatments.py:54 forms_treatments.py:96
#: forms_treatments.py:284 forms_treatments.py:356 forms_treatments.py:406
-#: forms_treatments.py:489 models_treatments.py:102 models_treatments.py:466
+#: forms_treatments.py:489 models_treatments.py:103 models_treatments.py:483
msgid "Year"
msgstr ""
-#: forms.py:338
+#: forms.py:342
msgid "Operation's number (index by year)"
msgstr ""
-#: forms.py:341
+#: forms.py:345
msgid "Code PATRIARCHE"
msgstr ""
-#: forms.py:345
+#: forms.py:349
msgid "Archaeological site"
msgstr ""
-#: forms.py:351
+#: forms.py:355
msgid "Search within related operations"
msgstr ""
-#: forms.py:355 models_finds.py:112
+#: forms.py:359 models_finds.py:111
msgid "Object type"
msgstr ""
-#: forms.py:368 forms_treatments.py:57
+#: forms.py:372 forms_treatments.py:57
msgid "Has an image?"
msgstr ""
-#: forms.py:417
+#: forms.py:421
msgid "Warehouse (location)"
msgstr ""
-#: forms.py:423
+#: forms.py:427
msgid "Warehouse (responsible)"
msgstr ""
-#: forms.py:428
+#: forms.py:432
msgid "Container ID"
msgstr ""
-#: forms.py:429
+#: forms.py:433
msgid "Container ref."
msgstr ""
-#: forms.py:433 forms.py:456 views.py:149
+#: forms.py:437 forms.py:460 views.py:149
msgid "Find search"
msgstr ""
-#: forms.py:481 templates/ishtar/sheet_treatment.html:46
+#: forms.py:485 templates/ishtar/sheet_treatment.html:46
msgid "Upstream finds"
msgstr ""
-#: forms.py:483 models_finds.py:669
+#: forms.py:487 models_finds.py:684
msgid "Finds"
msgstr ""
-#: forms.py:495
+#: forms.py:499
msgid "You should at least select one archaeological find."
msgstr ""
-#: forms.py:598
+#: forms.py:602
msgid "Resulting find"
msgstr ""
-#: forms.py:603
+#: forms.py:607
msgid "Precise description"
msgstr ""
-#: forms.py:618
+#: forms.py:622
msgid "Resulting finds"
msgstr ""
-#: forms.py:623
+#: forms.py:627
msgid "Would you like to delete this find?"
msgstr ""
-#: forms.py:627 models_treatments.py:90
+#: forms.py:631 models_treatments.py:91
msgid "Upstream find"
msgstr ""
-#: forms.py:640
+#: forms.py:644
msgid "Archaeological find search"
msgstr ""
-#: forms.py:642
+#: forms.py:646
msgid "You should select an archaeological find."
msgstr ""
-#: forms.py:647
+#: forms.py:651
msgid "Year of the operation"
msgstr ""
-#: forms.py:649
+#: forms.py:653
msgid "Numeric reference"
msgstr ""
-#: forms.py:656
+#: forms.py:660
msgid "Period of the archaeological find"
msgstr ""
-#: forms.py:658
+#: forms.py:662
msgid "Material type of the archaeological find"
msgstr ""
-#: forms.py:660
+#: forms.py:664
msgid "Description of the archaeological find"
msgstr ""
-#: forms.py:672 forms_treatments.py:590 forms_treatments.py:616
+#: forms.py:676 forms_treatments.py:590 forms_treatments.py:616
msgid "Documentation search"
msgstr ""
-#: forms.py:674 forms_treatments.py:592 forms_treatments.py:618
+#: forms.py:678 forms_treatments.py:592 forms_treatments.py:618
msgid "You should select a document."
msgstr ""
-#: forms.py:691
+#: forms.py:695
msgid "Another basket already exists with this name."
msgstr ""
-#: forms.py:701 forms.py:705 forms_treatments.py:175 ishtar_menu.py:57
+#: forms.py:705 forms.py:709 forms_treatments.py:175 ishtar_menu.py:57
msgid "Basket"
msgstr ""
-#: forms_treatments.py:52 forms_treatments.py:92 models_treatments.py:98
+#: forms_treatments.py:52 forms_treatments.py:92 models_treatments.py:99
#: templates/ishtar/sheet_find.html:85 templates/ishtar/sheet_find.html:127
msgid "Label"
msgstr ""
-#: forms_treatments.py:53 forms_treatments.py:95 models_treatments.py:100
+#: forms_treatments.py:53 forms_treatments.py:95 models_treatments.py:101
msgid "Other ref."
msgstr ""
#: forms_treatments.py:55 forms_treatments.py:237 forms_treatments.py:285
#: forms_treatments.py:348 forms_treatments.py:357 forms_treatments.py:459
-#: forms_treatments.py:490 forms_treatments.py:557 models_treatments.py:104
-#: models_treatments.py:468
+#: forms_treatments.py:490 forms_treatments.py:557 models_treatments.py:105
+#: models_treatments.py:485
msgid "Index"
msgstr ""
#: forms_treatments.py:56 forms_treatments.py:101 forms_treatments.py:301
-#: forms_treatments.py:578 models_treatments.py:56 models_treatments.py:109
-#: models_treatments.py:291
+#: forms_treatments.py:578 models_treatments.py:56 models_treatments.py:110
+#: models_treatments.py:308
msgid "Treatment type"
msgstr ""
@@ -380,7 +381,7 @@ msgstr ""
msgid "Base treatment"
msgstr ""
-#: forms_treatments.py:103 models_treatments.py:92 models_treatments.py:111
+#: forms_treatments.py:103 models_treatments.py:93 models_treatments.py:112
#: templates/ishtar/sheet_find.html:87 templates/ishtar/sheet_find.html:129
msgid "State"
msgstr ""
@@ -389,15 +390,15 @@ msgstr ""
msgid "Target"
msgstr ""
-#: forms_treatments.py:107 forms_treatments.py:417 models_treatments.py:119
+#: forms_treatments.py:107 forms_treatments.py:417 models_treatments.py:120
msgid "Responsible"
msgstr ""
-#: forms_treatments.py:113 models_treatments.py:122
+#: forms_treatments.py:113 models_treatments.py:123
msgid "Organization"
msgstr ""
-#: forms_treatments.py:119 models_treatments.py:114 models_treatments.py:294
+#: forms_treatments.py:119 models_treatments.py:115 models_treatments.py:311
msgid "Location"
msgstr ""
@@ -409,12 +410,12 @@ msgstr ""
msgid "External ref."
msgstr ""
-#: forms_treatments.py:136 models_treatments.py:128
+#: forms_treatments.py:136 models_treatments.py:129
msgid "Goal"
msgstr ""
-#: forms_treatments.py:140 forms_treatments.py:442 models_treatments.py:130
-#: models_treatments.py:488
+#: forms_treatments.py:140 forms_treatments.py:442 models_treatments.py:131
+#: models_treatments.py:505
msgid "Closing date"
msgstr ""
@@ -460,12 +461,12 @@ msgstr ""
msgid "Another treatment with this index exists for {}."
msgstr ""
-#: forms_treatments.py:262 models_treatments.py:107
+#: forms_treatments.py:262 models_treatments.py:108
msgid "Associated request"
msgstr ""
#: forms_treatments.py:266 forms_treatments.py:397 ishtar_menu.py:108
-#: models_treatments.py:499 models_treatments.py:521 models_treatments.py:584
+#: models_treatments.py:516 models_treatments.py:544 models_treatments.py:619
#: wizards.py:187 templates/ishtar/sheet_treatmentfile.html:5
msgid "Treatment request"
msgstr ""
@@ -521,7 +522,7 @@ msgstr ""
msgid "Modified by"
msgstr ""
-#: forms_treatments.py:354 forms_treatments.py:404 models_treatments.py:473
+#: forms_treatments.py:354 forms_treatments.py:404 models_treatments.py:490
msgid "Name"
msgstr ""
@@ -529,7 +530,7 @@ msgstr ""
msgid "Internal ref."
msgstr ""
-#: forms_treatments.py:358 forms_treatments.py:415 models_treatments.py:91
+#: forms_treatments.py:358 forms_treatments.py:415 models_treatments.py:92
#: templates/ishtar/sheet_find.html:86 templates/ishtar/sheet_find.html:128
#: templates/ishtar/sheet_find.html:228
msgid "Type"
@@ -539,12 +540,12 @@ msgstr ""
msgid "In charge"
msgstr ""
-#: forms_treatments.py:366 forms_treatments.py:423 models_treatments.py:482
+#: forms_treatments.py:366 forms_treatments.py:423 models_treatments.py:499
#: templates/ishtar/sheet_treatmentfile.html:31
msgid "Applicant"
msgstr ""
-#: forms_treatments.py:372 forms_treatments.py:429 models_treatments.py:486
+#: forms_treatments.py:372 forms_treatments.py:429 models_treatments.py:503
#: templates/ishtar/sheet_treatmentfile.html:38
msgid "Applicant organisation"
msgstr ""
@@ -553,7 +554,7 @@ msgstr ""
msgid "Treatment request search"
msgstr ""
-#: forms_treatments.py:439 models_treatments.py:492
+#: forms_treatments.py:439 models_treatments.py:509
msgid "Reception date"
msgstr ""
@@ -585,8 +586,8 @@ msgstr ""
msgid "Treatment request internal reference"
msgstr ""
-#: forms_treatments.py:508 forms_treatments.py:604 models_treatments.py:451
-#: models_treatments.py:475
+#: forms_treatments.py:508 forms_treatments.py:604 models_treatments.py:468
+#: models_treatments.py:492
msgid "Treatment request type"
msgstr ""
@@ -628,7 +629,7 @@ msgstr ""
msgid "Documentation"
msgstr ""
-#: ishtar_menu.py:133 ishtar_menu.py:214 models_finds.py:1082
+#: ishtar_menu.py:133 ishtar_menu.py:214 models_finds.py:1137
msgid "Administrative act"
msgstr ""
@@ -641,8 +642,8 @@ msgstr ""
msgid "Source"
msgstr ""
-#: ishtar_menu.py:185 models_treatments.py:147 models_treatments.py:283
-#: models_treatments.py:567 models_treatments.py:570
+#: ishtar_menu.py:185 models_treatments.py:148 models_treatments.py:300
+#: models_treatments.py:590 models_treatments.py:593
#: templates/ishtar/sheet_treatment.html:5
msgid "Treatment"
msgstr ""
@@ -651,113 +652,113 @@ msgstr ""
msgid "Simple treatments"
msgstr ""
-#: models_finds.py:44
+#: models_finds.py:43
msgid "Code"
msgstr ""
-#: models_finds.py:45
+#: models_finds.py:44
msgid "Recommendation"
msgstr ""
-#: models_finds.py:48
+#: models_finds.py:47
msgid "Parent material"
msgstr ""
-#: models_finds.py:52 models_finds.py:525 models_finds.py:602
+#: models_finds.py:51 models_finds.py:539 models_finds.py:616
msgid "Material types"
msgstr ""
-#: models_finds.py:60
+#: models_finds.py:59
msgid "Parent conservatory state"
msgstr ""
-#: models_finds.py:64
+#: models_finds.py:63
msgid "Conservatory states"
msgstr ""
-#: models_finds.py:73
+#: models_finds.py:72
msgid "Preservation types"
msgstr ""
-#: models_finds.py:81
+#: models_finds.py:80
msgid "Integrity / interest type"
msgstr ""
-#: models_finds.py:82
+#: models_finds.py:81
msgid "Integrity / interest types"
msgstr ""
-#: models_finds.py:90
+#: models_finds.py:89
msgid "Remarkability type"
msgstr ""
-#: models_finds.py:91
+#: models_finds.py:90
msgid "Remarkability types"
msgstr ""
-#: models_finds.py:98 models_finds.py:598 models_treatments.py:40
-#: models_treatments.py:287
+#: models_finds.py:97 models_finds.py:612 models_treatments.py:40
+#: models_treatments.py:304
msgid "Order"
msgstr ""
-#: models_finds.py:100
+#: models_finds.py:99
msgid "Batch type"
msgstr ""
-#: models_finds.py:101
+#: models_finds.py:100
msgid "Batch types"
msgstr ""
-#: models_finds.py:109
+#: models_finds.py:108
msgid "Parent"
msgstr ""
-#: models_finds.py:152 models_finds.py:595 models_treatments.py:124
-#: models_treatments.py:471
+#: models_finds.py:151 models_finds.py:609 models_treatments.py:125
+#: models_treatments.py:488
msgid "External ID"
msgstr ""
-#: models_finds.py:154 models_finds.py:597
+#: models_finds.py:153 models_finds.py:611
msgid "External ID is set automatically"
msgstr ""
-#: models_finds.py:157
+#: models_finds.py:156
msgid "Special interest"
msgstr ""
-#: models_finds.py:161
+#: models_finds.py:160
msgid "Context Record"
msgstr ""
-#: models_finds.py:162
+#: models_finds.py:161
msgid "Discovery date"
msgstr ""
-#: models_finds.py:167
+#: models_finds.py:166
msgid "Material index"
msgstr ""
-#: models_finds.py:183
+#: models_finds.py:182
msgid "Point (2D)"
msgstr ""
-#: models_finds.py:184
+#: models_finds.py:183
msgid "Point"
msgstr ""
-#: models_finds.py:185
+#: models_finds.py:184
msgid "Line"
msgstr ""
-#: models_finds.py:186
+#: models_finds.py:185
msgid "Polygon"
msgstr ""
-#: models_finds.py:189 models_finds.py:192
+#: models_finds.py:188 models_finds.py:191
msgid "Cached value - do not edit"
msgstr ""
-#: models_finds.py:197 models_finds.py:593
+#: models_finds.py:197 models_finds.py:607
msgid "Base find"
msgstr ""
@@ -785,149 +786,169 @@ msgstr ""
msgid "Can delete own Base find"
msgstr ""
-#: models_finds.py:430
+#: models_finds.py:443
msgid "g"
msgstr ""
-#: models_finds.py:431
+#: models_finds.py:444
msgid "kg"
msgstr ""
-#: models_finds.py:433
+#: models_finds.py:446
msgid "Not checked"
msgstr ""
-#: models_finds.py:434
+#: models_finds.py:447
msgid "Checked but incorrect"
msgstr ""
-#: models_finds.py:435
+#: models_finds.py:448
msgid "Checked and correct"
msgstr ""
-#: models_finds.py:506
+#: models_finds.py:520
msgid "Base find - Short ID"
msgstr ""
-#: models_finds.py:507
+#: models_finds.py:521
msgid "Base find - Complete ID"
msgstr ""
-#: models_finds.py:509
+#: models_finds.py:523
msgid "Operation (code)"
msgstr ""
-#: models_finds.py:511
+#: models_finds.py:525
msgid "Town"
msgstr ""
-#: models_finds.py:513
+#: models_finds.py:527
msgid "Operation (name)"
msgstr ""
-#: models_finds.py:515
+#: models_finds.py:529
msgid "Parcel"
msgstr ""
-#: models_finds.py:516
+#: models_finds.py:530
msgid "Batch"
msgstr ""
-#: models_finds.py:517
+#: models_finds.py:531
msgid "Base find - Comment"
msgstr ""
-#: models_finds.py:518
+#: models_finds.py:532
msgid "Base find - Description"
msgstr ""
-#: models_finds.py:519
+#: models_finds.py:533
msgid "Base find - Topographic localisation"
msgstr ""
-#: models_finds.py:521
+#: models_finds.py:535
msgid "Base find - Special interest"
msgstr ""
-#: models_finds.py:522
+#: models_finds.py:536
msgid "Base find - Discovery date"
msgstr ""
-#: models_finds.py:523 models_finds.py:626 models_treatments.py:131
-#: models_treatments.py:295 templates/ishtar/sheet_find.html:90
+#: models_finds.py:537 models_finds.py:640 models_treatments.py:132
+#: models_treatments.py:312 templates/ishtar/sheet_find.html:90
#: templates/ishtar/sheet_find.html:132
msgid "Container"
msgstr ""
-#: models_finds.py:524
+#: models_finds.py:538
msgid "Periods"
msgstr ""
-#: models_finds.py:609
+#: models_finds.py:623
msgid "Type of preservation to consider"
msgstr ""
-#: models_finds.py:613
+#: models_finds.py:627
msgid "Weight unit"
msgstr ""
-#: models_finds.py:619 templates/ishtar/sheet_find.html:78
+#: models_finds.py:633 templates/ishtar/sheet_find.html:78
msgid "Upstream treatment"
msgstr ""
-#: models_finds.py:622 templates/ishtar/sheet_find.html:120
+#: models_finds.py:636 templates/ishtar/sheet_find.html:120
msgid "Downstream treatment"
msgstr ""
-#: models_finds.py:660
+#: models_finds.py:675
msgid "Collection"
msgstr ""
-#: models_finds.py:662 models_treatments.py:143 models_treatments.py:495
+#: models_finds.py:677 models_treatments.py:144 models_treatments.py:512
msgid "Cached name"
msgstr ""
-#: models_finds.py:671
+#: models_finds.py:686
msgid "Can view all Finds"
msgstr ""
-#: models_finds.py:672
+#: models_finds.py:687
msgid "Can view own Find"
msgstr ""
-#: models_finds.py:673
+#: models_finds.py:688
msgid "Can add own Find"
msgstr ""
-#: models_finds.py:674
+#: models_finds.py:689
msgid "Can change own Find"
msgstr ""
-#: models_finds.py:675
+#: models_finds.py:690
msgid "Can delete own Find"
msgstr ""
-#: models_finds.py:681
+#: models_finds.py:696
msgid "FIND"
msgstr ""
-#: models_finds.py:1069
+#: models_finds.py:1100
msgid "Find documentation"
msgstr ""
-#: models_finds.py:1070
+#: models_finds.py:1101
msgid "Find documentations"
msgstr ""
-#: models_finds.py:1083
+#: models_finds.py:1104
+msgid "Can view all Find sources"
+msgstr ""
+
+#: models_finds.py:1106
+msgid "Can view own Find source"
+msgstr ""
+
+#: models_finds.py:1108
+msgid "Can add own Find source"
+msgstr ""
+
+#: models_finds.py:1110
+msgid "Can change own Find source"
+msgstr ""
+
+#: models_finds.py:1112
+msgid "Can delete own Find source"
+msgstr ""
+
+#: models_finds.py:1138
msgid "Person"
msgstr ""
-#: models_finds.py:1089
+#: models_finds.py:1144
msgid "Property"
msgstr ""
-#: models_finds.py:1090
+#: models_finds.py:1145
msgid "Properties"
msgstr ""
@@ -967,136 +988,200 @@ msgstr ""
msgid "Treatment state types"
msgstr ""
-#: models_treatments.py:89
+#: models_treatments.py:90
msgid "Downstream find"
msgstr ""
-#: models_treatments.py:116
+#: models_treatments.py:117
msgid "Location where the treatment is done. Target warehouse for a move."
msgstr ""
-#: models_treatments.py:133
+#: models_treatments.py:134
msgid "Estimated cost"
msgstr ""
-#: models_treatments.py:135
+#: models_treatments.py:136
msgid "Quoted cost"
msgstr ""
-#: models_treatments.py:137
+#: models_treatments.py:138
msgid "Realized cost"
msgstr ""
-#: models_treatments.py:139
+#: models_treatments.py:140
msgid "Insurance cost"
msgstr ""
-#: models_treatments.py:141
+#: models_treatments.py:142
msgid "Target a basket"
msgstr ""
-#: models_treatments.py:148 templates/ishtar/sheet_find.html:75
+#: models_treatments.py:149 templates/ishtar/sheet_find.html:75
#: templates/ishtar/sheet_treatmentfile.html:46
msgid "Treatments"
msgstr ""
-#: models_treatments.py:151
+#: models_treatments.py:152
msgid "Can view all Treatments"
msgstr ""
-#: models_treatments.py:152
+#: models_treatments.py:153
msgid "Can view own Treatment"
msgstr ""
-#: models_treatments.py:153
+#: models_treatments.py:154
msgid "Can add own Treatment"
msgstr ""
-#: models_treatments.py:154
+#: models_treatments.py:155
msgid "Can change own Treatment"
msgstr ""
-#: models_treatments.py:155
+#: models_treatments.py:156
msgid "Can delete own Treatment"
msgstr ""
-#: models_treatments.py:167
+#: models_treatments.py:168
msgid "TREATMENT"
msgstr ""
-#: models_treatments.py:296 templates/ishtar/sheet_find.html:89
+#: models_treatments.py:313 templates/ishtar/sheet_find.html:89
#: templates/ishtar/sheet_find.html:131
msgid "Doer"
msgstr ""
-#: models_treatments.py:297 models_treatments.py:298
+#: models_treatments.py:314 models_treatments.py:315
msgid "Related finds"
msgstr ""
-#: models_treatments.py:440
+#: models_treatments.py:457
msgid "Is upstream"
msgstr ""
-#: models_treatments.py:452
+#: models_treatments.py:469
msgid "Treatment request types"
msgstr ""
-#: models_treatments.py:469
+#: models_treatments.py:486
msgid "Internal reference"
msgstr ""
-#: models_treatments.py:478
+#: models_treatments.py:495
msgid "Person in charge"
msgstr ""
-#: models_treatments.py:490
+#: models_treatments.py:507
msgid "Creation date"
msgstr ""
-#: models_treatments.py:500
+#: models_treatments.py:517
msgid "Treatment requests"
msgstr ""
-#: models_treatments.py:504
+#: models_treatments.py:521
msgid "Can view all Treatment requests"
msgstr ""
-#: models_treatments.py:506
+#: models_treatments.py:523
+msgid "Can add Treatment request"
+msgstr ""
+
+#: models_treatments.py:525
+msgid "Can change Treatment request"
+msgstr ""
+
+#: models_treatments.py:527
+msgid "Can delete Treatment request"
+msgstr ""
+
+#: models_treatments.py:529
msgid "Can view own Treatment request"
msgstr ""
-#: models_treatments.py:508
+#: models_treatments.py:531
msgid "Can add own Treatment request"
msgstr ""
-#: models_treatments.py:510
+#: models_treatments.py:533
msgid "Can change own Treatment request"
msgstr ""
-#: models_treatments.py:512
+#: models_treatments.py:535
msgid "Can delete own Treatment request"
msgstr ""
-#: models_treatments.py:574
+#: models_treatments.py:597
msgid "Treatment documentation"
msgstr ""
-#: models_treatments.py:575
+#: models_treatments.py:598
msgid "Treament documentations"
msgstr ""
-#: models_treatments.py:588
+#: models_treatments.py:601
+msgid "Can view all Treatment source"
+msgstr ""
+
+#: models_treatments.py:603
+msgid "Can view own Treatment source"
+msgstr ""
+
+#: models_treatments.py:605
+msgid "Can add own Treatment source"
+msgstr ""
+
+#: models_treatments.py:607
+msgid "Can change own Treatment source"
+msgstr ""
+
+#: models_treatments.py:609
+msgid "Can delete own Treatment source"
+msgstr ""
+
+#: models_treatments.py:623
msgid "Treatment file"
msgstr ""
-#: models_treatments.py:592
+#: models_treatments.py:627
msgid "Treatment request documentation"
msgstr ""
-#: models_treatments.py:593
+#: models_treatments.py:628
msgid "Treatment request documentations"
msgstr ""
+#: models_treatments.py:631
+msgid "Can view all Treatment request source"
+msgstr ""
+
+#: models_treatments.py:633
+msgid "Can add Treatment request source"
+msgstr ""
+
+#: models_treatments.py:635
+msgid "Can change Treatment request source"
+msgstr ""
+
+#: models_treatments.py:637
+msgid "Can delete Treatment request source"
+msgstr ""
+
+#: models_treatments.py:639
+msgid "Can view own Treatment request source"
+msgstr ""
+
+#: models_treatments.py:641
+msgid "Can add own Treatment request source"
+msgstr ""
+
+#: models_treatments.py:643
+msgid "Can change own Treatment request source"
+msgstr ""
+
+#: models_treatments.py:645
+msgid "Can delete own Treatment request source"
+msgstr ""
+
#: views.py:138
msgid "New find"
msgstr ""
diff --git a/archaeological_finds/models_finds.py b/archaeological_finds/models_finds.py
index c54fd1ed9..d33933264 100644
--- a/archaeological_finds/models_finds.py
+++ b/archaeological_finds/models_finds.py
@@ -31,13 +31,12 @@ from ishtar_common.utils import cached_label_changed, post_save_point
from ishtar_common.models import GeneralType, ImageModel, BaseHistorizedItem, \
ShortMenuItem, LightHistorizedItem, HistoricalRecords, OwnPerms, Source, \
- Person, Basket, get_external_id, post_save_cache
+ Person, Basket, get_external_id, post_save_cache, ValueGetter
from archaeological_operations.models import AdministrativeAct
from archaeological_context_records.models import ContextRecord, Dating
from ishtar_common.models import PRIVATE_FIELDS, SpatialReferenceSystem
-from archaeological_warehouse.models import Container, Collection
class MaterialType(GeneralType):
@@ -192,6 +191,7 @@ class BaseFind(BaseHistorizedItem, OwnPerms):
help_text=_(u"Cached value - do not edit"))
history = HistoricalRecords()
RELATED_POST_PROCESS = ['find']
+ CACHED_LABELS = ['cache_short_id', 'cache_complete_id']
class Meta:
verbose_name = _(u"Base find")
@@ -254,6 +254,9 @@ class BaseFind(BaseHistorizedItem, OwnPerms):
).format(self.index))
return settings.JOINT.join(c_id)
+ def _generate_cache_complete_id(self):
+ return self.complete_id()
+
def short_id(self):
# OPE|FIND_index
c_id = [self._ope_code()]
@@ -261,6 +264,9 @@ class BaseFind(BaseHistorizedItem, OwnPerms):
).format(self.index))
return settings.JOINT.join(c_id)
+ def _generate_cache_short_id(self):
+ return self.short_id()
+
def full_label(self):
return self._real_label() or self._temp_label() or u""
@@ -323,7 +329,8 @@ class BaseFind(BaseHistorizedItem, OwnPerms):
return returned
@classmethod
- def cached_label_bulk_update(cls, operation_id=None, parcel_id=None):
+ def cached_label_bulk_update(cls, operation_id=None, parcel_id=None,
+ context_record_id=None):
if operation_id:
filters = """
INNER JOIN archaeological_context_records_contextrecord acr
@@ -338,6 +345,12 @@ class BaseFind(BaseHistorizedItem, OwnPerms):
"""
args = [int(parcel_id)]
kwargs = {'parcel_id': parcel_id}
+ elif context_record_id:
+ filters = """
+ WHERE mybf.context_record_id = %s
+ """
+ args = [int(context_record_id)]
+ kwargs = {'context_record_id': context_record_id}
else:
return
@@ -477,7 +490,8 @@ class FBulkView(object):
"""
-class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem):
+class Find(ValueGetter, BaseHistorizedItem, ImageModel, OwnPerms,
+ ShortMenuItem):
CHECK_DICT = dict(CHECK_CHOICES)
SHOW_URL = 'show-find'
SLUG = 'find'
@@ -623,7 +637,8 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem):
datings = models.ManyToManyField(Dating, verbose_name=_(u"Dating"),
related_name='find')
container = models.ForeignKey(
- Container, verbose_name=_(u"Container"), blank=True, null=True,
+ "archaeological_warehouse.Container", verbose_name=_(u"Container"),
+ blank=True, null=True,
related_name='finds', on_delete=models.SET_NULL)
is_complete = models.NullBooleanField(_(u"Is complete?"), blank=True,
null=True)
@@ -657,8 +672,8 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem):
estimated_value = models.FloatField(_(u"Estimated value"), blank=True,
null=True)
collection = models.ForeignKey(
- Collection, verbose_name=_(u"Collection"), blank=True, null=True,
- related_name='finds', on_delete=models.SET_NULL)
+ "archaeological_warehouse.Collection", verbose_name=_(u"Collection"),
+ blank=True, null=True, related_name='finds', on_delete=models.SET_NULL)
cached_label = models.TextField(_(u"Cached name"), null=True, blank=True)
history = HistoricalRecords()
BASKET_MODEL = FindBasket
@@ -847,16 +862,20 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem):
def duplicate(self, user):
model = self.__class__
- # base fields
- table_cols = [field.name for field in model._meta.fields
- if field.name not in PRIVATE_FIELDS or
- field.name == 'order']
- dct = dict([(attr, getattr(self, attr)) for attr in
- table_cols])
- dct['order'] += 1
- dct['history_modifier'] = user
- new = self.__class__(**dct)
- new.save()
+
+ new = model.objects.get(pk=self.pk)
+
+ for field in model._meta.fields:
+ # pk is in PRIVATE_FIELDS so: new.pk = None and a new
+ # item will be created on save
+ if field.name in PRIVATE_FIELDS:
+ setattr(new, field.name, None)
+ new.order = self.order + 1
+ new.history_order = user
+ new.image.name = self.image.name
+ # force_copy is necessary to not regenerate a thumb and resize
+ # again the image
+ new.save(force_copy=True)
# m2m fields
m2m = [field.name for field in model._meta.many_to_many
@@ -868,11 +887,14 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem):
@classmethod
def get_query_owns(cls, user):
- return Q(base_finds__context_record__operation__scientist=user.
- ishtaruser.person) | \
- Q(base_finds__context_record__operation__in_charge=user.
- ishtaruser.person) | \
- Q(history_creator=user)
+ return (Q(base_finds__context_record__operation__scientist=user.
+ ishtaruser.person) |
+ Q(base_finds__context_record__operation__in_charge=user.
+ ishtaruser.person) |
+ Q(base_finds__context_record__operation__collaborators__pk=user.
+ ishtaruser.person.pk) |
+ Q(history_creator=user)) \
+ & Q(base_finds__context_record__operation__end_date__isnull=True)
@classmethod
def get_owns(cls, user, menu_filtr=None, limit=None,
@@ -891,7 +913,8 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem):
return unicode(self)
@classmethod
- def cached_label_bulk_update(cls, operation_id=None, parcel_id=None):
+ def cached_label_bulk_update(cls, operation_id=None, parcel_id=None,
+ context_record_id=None):
if operation_id:
filters = """
INNER JOIN find_first_base_find myfbf
@@ -912,6 +935,14 @@ class Find(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem):
ON acr.parcel_id = %s AND acr.id = mybf.context_record_id
"""
args = [int(parcel_id)]
+ elif context_record_id:
+ filters = """
+ INNER JOIN find_first_base_find myfbf
+ ON myfbf.find_id = myf.id
+ INNER JOIN archaeological_finds_basefind mybf
+ ON myfbf.basefind_id = mybf.id AND mybf.context_record_id = %s
+ """
+ args = [int(context_record_id)]
else:
return
@@ -1068,6 +1099,18 @@ class FindSource(Source):
class Meta:
verbose_name = _(u"Find documentation")
verbose_name_plural = _(u"Find documentations")
+ permissions = (
+ ("view_findsource",
+ ugettext(u"Can view all Find sources")),
+ ("view_own_findsource",
+ ugettext(u"Can view own Find source")),
+ ("add_own_findsource",
+ ugettext(u"Can add own Find source")),
+ ("change_own_findsource",
+ ugettext(u"Can change own Find source")),
+ ("delete_own_findsource",
+ ugettext(u"Can delete own Find source")),
+ )
find = models.ForeignKey(Find, verbose_name=_(u"Find"),
related_name="source")
@@ -1075,6 +1118,18 @@ class FindSource(Source):
def owner(self):
return self.find
+ @classmethod
+ def get_query_owns(cls, user):
+ return (Q(find__base_finds__context_record__operation__scientist=user.
+ ishtaruser.person) |
+ Q(find__base_finds__context_record__operation__in_charge=user.
+ ishtaruser.person) |
+ Q(
+ find__base_finds__context_record__operation__collaborators__pk=user.
+ ishtaruser.person.pk)) \
+ & Q(
+ find__base_finds__context_record__operation__end_date__isnull=True)
+
class Property(LightHistorizedItem):
find = models.ForeignKey(Find, verbose_name=_(u"Find"))
diff --git a/archaeological_finds/models_treatments.py b/archaeological_finds/models_treatments.py
index 4a453f538..d3e18122c 100644
--- a/archaeological_finds/models_treatments.py
+++ b/archaeological_finds/models_treatments.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
-# Copyright (C) 2016 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet>
+# Copyright (C) 2016-2017 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet>
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
@@ -30,7 +30,7 @@ from django.utils.translation import ugettext_lazy as _, ugettext
from ishtar_common.utils import cached_label_changed
from ishtar_common.models import GeneralType, ImageModel, BaseHistorizedItem, \
OwnPerms, HistoricalRecords, Person, Organization, Source, \
- ValueGetter, post_save_cache, ShortMenuItem
+ ValueGetter, post_save_cache, ShortMenuItem, DashboardFormItem
from archaeological_warehouse.models import Warehouse, Container
from archaeological_finds.models_finds import Find, FindBasket
from archaeological_operations.models import ClosedItem, Operation
@@ -69,7 +69,8 @@ post_save.connect(post_save_cache, sender=TreatmentState)
post_delete.connect(post_save_cache, sender=TreatmentState)
-class Treatment(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem):
+class Treatment(DashboardFormItem, ValueGetter, BaseHistorizedItem,
+ ImageModel, OwnPerms, ShortMenuItem):
SHOW_URL = 'show-treatment'
TABLE_COLS = ('year', 'index', 'treatment_types__label',
'treatment_state__label',
@@ -179,7 +180,8 @@ class Treatment(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem):
if menu_filtr:
if 'treatmentfile' in menu_filtr:
replace_query = Q(file=menu_filtr['treatmentfile'])
- if 'find' in menu_filtr and 'basket' not in str(menu_filtr['find']):
+ if 'find' in menu_filtr and \
+ 'basket' not in str(menu_filtr['find']):
q = Q(upstream=menu_filtr['find']) | Q(
downstream=menu_filtr['find'])
if replace_query:
@@ -208,6 +210,21 @@ class Treatment(BaseHistorizedItem, ImageModel, OwnPerms, ShortMenuItem):
"""
return u" ; ".join([unicode(t) for t in self.treatment_types.all()])
+ def get_values(self, prefix=''):
+ values = super(Treatment, self).get_values(prefix=prefix)
+ values[prefix + "upstream_finds"] = u" ; ".join(
+ [unicode(up) for up in self.upstream.all()])
+ values[prefix + "downstream_finds"] = u" ; ".join(
+ [unicode(down) for down in self.downstream.all()])
+ values[prefix + "operations"] = u" ; ".join(
+ [unicode(ope) for ope in self.get_query_operations().all()])
+ if self.upstream.count():
+ find = self.upstream.all()[0]
+ if 'associatedfind_' not in prefix:
+ values.update(
+ find.get_values(prefix=prefix + 'associatedfind_'))
+ return values
+
def pre_save(self):
# is not new
if self.pk is not None:
@@ -455,8 +472,8 @@ post_save.connect(post_save_cache, sender=TreatmentFileType)
post_delete.connect(post_save_cache, sender=TreatmentFileType)
-class TreatmentFile(ClosedItem, BaseHistorizedItem, OwnPerms, ValueGetter,
- ShortMenuItem):
+class TreatmentFile(DashboardFormItem, ClosedItem, BaseHistorizedItem,
+ OwnPerms, ValueGetter, ShortMenuItem):
SLUG = 'treatmentfile'
SHOW_URL = 'show-treatmentfile'
TABLE_COLS = ['type', 'year', 'index', 'internal_reference', 'name']
@@ -502,6 +519,12 @@ class TreatmentFile(ClosedItem, BaseHistorizedItem, OwnPerms, ValueGetter,
permissions = (
("view_filetreatment",
ugettext(u"Can view all Treatment requests")),
+ ("add_filetreatment",
+ ugettext(u"Can add Treatment request")),
+ ("change_filetreatment",
+ ugettext(u"Can change Treatment request")),
+ ("delete_filetreatment",
+ ugettext(u"Can delete Treatment request")),
("view_own_filetreatment",
ugettext(u"Can view own Treatment request")),
("add_own_filetreatment",
@@ -573,6 +596,18 @@ class TreatmentSource(Source):
class Meta:
verbose_name = _(u"Treatment documentation")
verbose_name_plural = _(u"Treament documentations")
+ permissions = (
+ ("view_treatmentsource",
+ ugettext(u"Can view all Treatment sources")),
+ ("view_own_treatmentsource",
+ ugettext(u"Can view own Treatment source")),
+ ("add_own_treatmentsource",
+ ugettext(u"Can add own Treatment source")),
+ ("change_own_treatmentsource",
+ ugettext(u"Can change own Treatment source")),
+ ("delete_own_treatmentsource",
+ ugettext(u"Can delete own Treatment source")),
+ )
@property
def owner(self):
@@ -591,6 +626,24 @@ class TreatmentFileSource(Source):
class Meta:
verbose_name = _(u"Treatment request documentation")
verbose_name_plural = _(u"Treatment request documentations")
+ permissions = (
+ ("view_filetreatmentsource",
+ ugettext(u"Can view Treatment request source")),
+ ("add_filetreatmentsource",
+ ugettext(u"Can add Treatment request source")),
+ ("change_filetreatmentsource",
+ ugettext(u"Can change Treatment request source")),
+ ("delete_filetreatmentsource",
+ ugettext(u"Can delete Treatment request source")),
+ ("view_own_filetreatmentsource",
+ ugettext(u"Can view own Treatment request source")),
+ ("add_own_filetreatmentsource",
+ ugettext(u"Can add own Treatment request source")),
+ ("change_own_filetreatmentsource",
+ ugettext(u"Can change own Treatment request source")),
+ ("delete_own_filetreatmentsource",
+ ugettext(u"Can delete own Treatment request source")),
+ )
@property
def owner(self):
diff --git a/archaeological_finds/templates/ishtar/sheet_find.html b/archaeological_finds/templates/ishtar/sheet_find.html
index 912bf1b93..a78eb7706 100644
--- a/archaeological_finds/templates/ishtar/sheet_find.html
+++ b/archaeological_finds/templates/ishtar/sheet_find.html
@@ -200,14 +200,14 @@
{% field_li "Point of topographic reference" base_find.topographic_localisation %}
{% if base_find.x or base_find.y %}
- <li><label>{% trans "Coordinates:" %}</label>
+ <li><label>{% trans "Coordinates" %}</label>
<span class="value">
- {% trans "X:"%} {{base_find.x|default_if_none:"-"}},
- {% trans "Y:"%} {{base_find.y|default_if_none:"-"}},
- {% trans "Z:"%} {{base_find.z|default_if_none:"-"}}
+ {% trans "X"%} {{base_find.x|default_if_none:"-"}},
+ {% trans "Y"%} {{base_find.y|default_if_none:"-"}},
+ {% trans "Z"%} {{base_find.z|default_if_none:"-"}}
{% if base_find.spatial_reference_system %}
({{base_find.spatial_reference_system.label}}{% if base_find.spatial_reference_system.srid %} -
- {% trans "SRID:"%} {{base_find.spatial_reference_system.srid}}{% endif %})
+ {% trans "SRID"%} {{base_find.spatial_reference_system.srid}}{% endif %})
{% endif %}
</span>
{% endif %}
diff --git a/archaeological_finds/templates/ishtar/sheet_findbasket.html b/archaeological_finds/templates/ishtar/sheet_findbasket.html
index 6f8b12e6d..b6d4ffd42 100644
--- a/archaeological_finds/templates/ishtar/sheet_findbasket.html
+++ b/archaeological_finds/templates/ishtar/sheet_findbasket.html
@@ -9,5 +9,5 @@
<p class="window-refs">{{ item.label|default:"" }}</p>
{% field "Owned by" item.user %}
{% field "Comment" item.comment %}
-{% dynamic_table_document_large finds 'finds_for_ope' 'basket' item.pk 'TABLE_COLS_FOR_OPE' output %}
+{% dynamic_table_document finds 'finds_for_ope' 'basket' item.pk 'TABLE_COLS_FOR_OPE' output %}
{% endblock %}
diff --git a/archaeological_finds/tests.py b/archaeological_finds/tests.py
index e274c757f..1268b4f03 100644
--- a/archaeological_finds/tests.py
+++ b/archaeological_finds/tests.py
@@ -21,6 +21,7 @@ import json
from django.conf import settings
from django.contrib.auth.models import User
+from django.core.files import File
from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.urlresolvers import reverse
from django.test.client import Client
@@ -474,8 +475,14 @@ class PackagingTest(FindInit, TestCase):
model = models.Find
def setUp(self):
+ img = settings.ROOT_PATH + \
+ '../ishtar_common/static/media/images/ishtar-bg.jpg'
+
self.create_finds({"label": u"Find 1"}, force=True)
self.create_finds({"label": u"Find 2"}, force=True)
+ self.finds[0].image.save('ishtar-bg.jpg', File(open(img)))
+ self.finds[0].save()
+
self.basket = models.FindBasket.objects.create(
label="My basket", user=IshtarUser.objects.get(
pk=self.get_default_user().pk))
@@ -490,11 +497,26 @@ class PackagingTest(FindInit, TestCase):
treatment_type = models.TreatmentType.objects.get(txt_idx='packaging')
treatment = models.Treatment()
items_nb = models.Find.objects.count()
+
+ first_find = self.finds[0]
+
treatment.save(user=self.get_default_user(), items=self.basket)
self.assertEqual(items_nb + self.basket.items.count(),
models.Find.objects.count(),
msg="Packaging doesn't generate enough new finds")
treatment.treatment_types.add(treatment_type)
+
+ resulting_find = models.Find.objects.get(
+ upstream_treatment__upstream=first_find,
+ base_finds__pk=first_find.base_finds.all()[0].pk
+ )
+
+ # image names used to be altered on save: check for this bug
+ self.assertEqual(
+ resulting_find.image.name,
+ models.Find.objects.get(pk=first_find.pk).image.name
+ )
+
# new version of the find is in the basket
for item in self.basket.items.all():
self.assertNotIn(
diff --git a/archaeological_finds/urls.py b/archaeological_finds/urls.py
index 06d505896..9c331ccc9 100644
--- a/archaeological_finds/urls.py
+++ b/archaeological_finds/urls.py
@@ -24,7 +24,7 @@ import views
from archaeological_finds import models
-# be carreful: each check_rights must be relevant with ishtar_menu
+# be careful: each check_rights must be relevant with ishtar_menu
# forms
urlpatterns = patterns(
@@ -33,7 +33,7 @@ urlpatterns = patterns(
check_rights(['view_find', 'view_own_find'])(
views.find_search_wizard), name='find_search'),
url(r'find_creation/(?P<step>.+)?$',
- check_rights(['add_find'])(
+ check_rights(['add_find', 'add_own_find'])(
views.find_creation_wizard), name='find_creation'),
url(r'find_modification/(?P<step>.+)?$',
check_rights(['change_find', 'change_own_find'])(
diff --git a/archaeological_finds/views.py b/archaeological_finds/views.py
index 03094cbb0..680faf421 100644
--- a/archaeological_finds/views.py
+++ b/archaeological_finds/views.py
@@ -169,7 +169,7 @@ find_modification_wizard = FindModificationWizard.as_view([
def find_modify(request, pk):
- # view = find_modification_wizard(request)
+ find_modification_wizard(request)
FindModificationWizard.session_set_value(
request, 'selec-find_modification', 'pk', pk, reset=True)
return redirect(