summaryrefslogtreecommitdiff
path: root/archaeological_operations
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_operations')
-rw-r--r--archaeological_operations/locale/django.pot346
-rw-r--r--archaeological_operations/models.py47
-rw-r--r--archaeological_operations/tests.py272
-rw-r--r--archaeological_operations/views.py16
4 files changed, 485 insertions, 196 deletions
diff --git a/archaeological_operations/locale/django.pot b/archaeological_operations/locale/django.pot
index f43875269..6cd5acef2 100644
--- a/archaeological_operations/locale/django.pot
+++ b/archaeological_operations/locale/django.pot
@@ -10,12 +10,12 @@ msgid ""
msgstr ""
#: forms.py:69 forms.py:371 forms.py:1009 forms.py:1031 forms.py:1035
-#: models.py:1217 templates/ishtar/sheet_operation.html:144
+#: models.py:1224 templates/ishtar/sheet_operation.html:144
#: templates/ishtar/blocks/window_tables/parcels.html:10
msgid "Parcels"
msgstr ""
-#: forms.py:72 forms.py:205 forms.py:985 models.py:1203
+#: forms.py:72 forms.py:205 forms.py:985 models.py:1210
#: templates/ishtar/blocks/window_tables/parcels.html:7
#: templates/ishtar/dashboards/dashboard_operation.html:432
#: templates/ishtar/dashboards/dashboard_operation.html:446
@@ -24,22 +24,22 @@ msgstr ""
msgid "Town"
msgstr ""
-#: forms.py:74 forms.py:455 forms.py:752 forms.py:1255 models.py:274
-#: models.py:1009 models.py:1201
+#: forms.py:74 forms.py:455 forms.py:752 forms.py:1255 models.py:275
+#: models.py:1016 models.py:1208
#: templates/ishtar/blocks/window_tables/parcels.html:8
msgid "Year"
msgstr ""
-#: forms.py:77 models.py:1204
+#: forms.py:77 models.py:1211
#: templates/ishtar/blocks/window_tables/parcels.html:9
msgid "Section"
msgstr ""
-#: forms.py:80 models.py:1206
+#: forms.py:80 models.py:1213
msgid "Parcel number"
msgstr ""
-#: forms.py:82 models.py:1208 models.py:1225 models.py:1274
+#: forms.py:82 models.py:1215 models.py:1232 models.py:1281
msgid "Public domain"
msgstr ""
@@ -75,8 +75,8 @@ msgstr ""
msgid "Relation type"
msgstr ""
-#: forms.py:383 ishtar_menu.py:30 models.py:369 models.py:830 models.py:860
-#: models.py:888 models.py:991 models.py:1200 wizards.py:344 wizards.py:355
+#: forms.py:383 ishtar_menu.py:30 models.py:370 models.py:837 models.py:867
+#: models.py:895 models.py:998 models.py:1207 wizards.py:344 wizards.py:355
#: templates/ishtar/sheet_operation.html:4
msgid "Operation"
msgstr ""
@@ -105,7 +105,7 @@ msgstr ""
msgid "Relations"
msgstr ""
-#: forms.py:456 forms.py:1226 models.py:275
+#: forms.py:456 forms.py:1226 models.py:276
msgid "Numeric reference"
msgstr ""
@@ -113,7 +113,7 @@ msgstr ""
msgid "Parcel (section/number/public domain)"
msgstr ""
-#: forms.py:465 forms.py:1269 models.py:831
+#: forms.py:465 forms.py:1269 models.py:838
#: templates/ishtar/dashboards/dashboard_operation.html:390
#: templates/ishtar/dashboards/dashboard_operation.html:411
#: templates/ishtar/dashboards/dashboard_operation.html:643
@@ -122,12 +122,12 @@ msgstr ""
msgid "Department"
msgstr ""
-#: forms.py:466 forms.py:1097 models.py:85
+#: forms.py:466 forms.py:1097 models.py:86
#: templates/ishtar/blocks/window_tables/archaeologicalsites.html:8
msgid "Name"
msgstr ""
-#: forms.py:468 forms.py:672 forms.py:750 forms.py:1232 models.py:282
+#: forms.py:468 forms.py:672 forms.py:750 forms.py:1232 models.py:283
msgid "Operation type"
msgstr ""
@@ -135,24 +135,24 @@ msgstr ""
msgid "Is open?"
msgstr ""
-#: forms.py:478 forms.py:782 models.py:271
+#: forms.py:478 forms.py:782 models.py:272
msgid "In charge"
msgstr ""
-#: forms.py:485 models.py:985
+#: forms.py:485 models.py:992
msgid "Scientist in charge"
msgstr ""
-#: forms.py:487 forms.py:674 forms.py:772 models.py:269
+#: forms.py:487 forms.py:674 forms.py:772 models.py:270
msgid "Operator"
msgstr ""
-#: forms.py:496 forms.py:1102 models.py:89 models.py:284
+#: forms.py:496 forms.py:1102 models.py:90 models.py:285
#: templates/ishtar/blocks/window_tables/archaeologicalsites.html:10
msgid "Remains"
msgstr ""
-#: forms.py:497 forms.py:1080 forms.py:1099 models.py:87 models.py:290
+#: forms.py:497 forms.py:1080 forms.py:1099 models.py:88 models.py:291
#: templates/ishtar/blocks/window_tables/archaeologicalsites.html:9
msgid "Periods"
msgstr ""
@@ -185,23 +185,23 @@ msgstr ""
msgid "Abstract (full text search)"
msgstr ""
-#: forms.py:512 forms.py:840 models.py:338
+#: forms.py:512 forms.py:840 models.py:339
msgid "Comment about scientific documentation"
msgstr ""
-#: forms.py:513 forms.py:842 models.py:350
+#: forms.py:513 forms.py:842 models.py:351
msgid "Record quality"
msgstr ""
-#: forms.py:514 forms.py:807 models.py:302
+#: forms.py:514 forms.py:807 models.py:303
msgid "Report processing"
msgstr ""
-#: forms.py:516 forms.py:845 models.py:345
+#: forms.py:516 forms.py:845 models.py:346
msgid "Virtual operation"
msgstr ""
-#: forms.py:518 forms.py:1142 forms.py:1146 models.py:93
+#: forms.py:518 forms.py:1142 forms.py:1146 models.py:94
msgid "Archaeological site"
msgstr ""
@@ -221,7 +221,7 @@ msgstr ""
msgid "Documentation deadline after"
msgstr ""
-#: forms.py:541 forms.py:830 models.py:357
+#: forms.py:541 forms.py:830 models.py:358
msgid "Documentation received"
msgstr ""
@@ -233,7 +233,7 @@ msgstr ""
msgid "Finds deadline after"
msgstr ""
-#: forms.py:547 forms.py:835 models.py:361
+#: forms.py:547 forms.py:835 models.py:362
msgid "Finds received"
msgstr ""
@@ -245,12 +245,12 @@ msgstr ""
msgid "Associated file"
msgstr ""
-#: forms.py:640 forms.py:933 models.py:497 models.py:887 models.py:996
+#: forms.py:640 forms.py:933 models.py:504 models.py:894 models.py:1003
#: wizards.py:80
msgid "Archaeological file"
msgstr ""
-#: forms.py:647 forms.py:649 models.py:352
+#: forms.py:647 forms.py:649 models.py:353
msgid "Abstract"
msgstr ""
@@ -262,7 +262,7 @@ msgstr ""
msgid "years"
msgstr ""
-#: forms.py:654 models.py:255
+#: forms.py:654 models.py:256
msgid "Creation date"
msgstr ""
@@ -319,11 +319,11 @@ msgstr ""
msgid "General"
msgstr ""
-#: forms.py:748 models.py:335
+#: forms.py:748 models.py:336
msgid "Generic name"
msgstr ""
-#: forms.py:757 models.py:304
+#: forms.py:757 models.py:305
msgid "Old code"
msgstr ""
@@ -331,7 +331,7 @@ msgstr ""
msgid "Head scientist"
msgstr ""
-#: forms.py:779 models.py:334
+#: forms.py:779 models.py:335
msgid "Operator reference"
msgstr ""
@@ -339,23 +339,23 @@ msgstr ""
msgid "Total surface (m2)"
msgstr ""
-#: forms.py:800 models.py:53 models.py:258 models.py:1399
+#: forms.py:800 models.py:54 models.py:259 models.py:1420
msgid "Start date"
msgstr ""
-#: forms.py:802 models.py:260
+#: forms.py:802 models.py:261
msgid "Excavation end date"
msgstr ""
-#: forms.py:805 models.py:261
+#: forms.py:805 models.py:262
msgid "Report delivery date"
msgstr ""
-#: forms.py:827 models.py:354
+#: forms.py:827 models.py:355
msgid "Deadline for submission of the documentation"
msgstr ""
-#: forms.py:832 models.py:359
+#: forms.py:832 models.py:360
msgid "Deadline for submission of the finds"
msgstr ""
@@ -390,7 +390,7 @@ msgstr ""
msgid "Bad operation code"
msgstr ""
-#: forms.py:929 models.py:512
+#: forms.py:929 models.py:519
msgid "Operation code"
msgstr ""
@@ -398,20 +398,20 @@ msgstr ""
msgid "Preventive informations - excavation"
msgstr ""
-#: forms.py:956 models.py:288
+#: forms.py:956 models.py:289
#: templates/ishtar/dashboards/dashboard_operation.html:701
msgid "Cost (euros)"
msgstr ""
-#: forms.py:957 models.py:293
+#: forms.py:957 models.py:294
msgid "Scheduled man-days"
msgstr ""
-#: forms.py:959 models.py:296
+#: forms.py:959 models.py:297
msgid "Optional man-days"
msgstr ""
-#: forms.py:961 models.py:299
+#: forms.py:961 models.py:300
msgid "Effective man-days"
msgstr ""
@@ -419,31 +419,31 @@ msgstr ""
msgid "Preventive informations - diagnostic"
msgstr ""
-#: forms.py:974 models.py:318
+#: forms.py:974 models.py:319
msgid "Prescription on zoning"
msgstr ""
-#: forms.py:976 models.py:321
+#: forms.py:976 models.py:322
msgid "Prescription on large area"
msgstr ""
-#: forms.py:979 models.py:323
+#: forms.py:979 models.py:324
msgid "Prescription on geoarchaeological context"
msgstr ""
-#: forms.py:983 forms.py:1005 models.py:286 models.py:1019
+#: forms.py:983 forms.py:1005 models.py:287 models.py:1026
msgid "Towns"
msgstr ""
-#: forms.py:1012 models.py:1216 models.py:1397
+#: forms.py:1012 models.py:1223 models.py:1418
msgid "Parcel"
msgstr ""
-#: forms.py:1064 models.py:45
+#: forms.py:1064 models.py:46
msgid "Remain types"
msgstr ""
-#: forms.py:1068 models.py:44
+#: forms.py:1068 models.py:45
msgid "Remain type"
msgstr ""
@@ -452,7 +452,7 @@ msgstr ""
msgid "Period"
msgstr ""
-#: forms.py:1096 models.py:84
+#: forms.py:1096 models.py:85
msgid "Reference"
msgstr ""
@@ -460,7 +460,7 @@ msgstr ""
msgid "This reference already exists."
msgstr ""
-#: forms.py:1157 models.py:94 models.py:342
+#: forms.py:1157 models.py:95 models.py:343
#: templates/ishtar/sheet_operation.html:94
msgid "Archaeological sites"
msgstr ""
@@ -481,7 +481,7 @@ msgstr ""
msgid "Would you like to delete this operation?"
msgstr ""
-#: forms.py:1186 forms.py:1256 forms.py:1392 models.py:862 models.py:976
+#: forms.py:1186 forms.py:1256 forms.py:1392 models.py:869 models.py:983
msgid "Index"
msgstr ""
@@ -508,7 +508,7 @@ msgstr ""
msgid "You should select a document."
msgstr ""
-#: forms.py:1263 forms.py:1330 models.py:901 models.py:970
+#: forms.py:1263 forms.py:1330 models.py:908 models.py:977
msgid "Act type"
msgstr ""
@@ -516,12 +516,12 @@ msgstr ""
msgid "Indexed?"
msgstr ""
-#: forms.py:1270 forms.py:1335 models.py:1010
+#: forms.py:1270 forms.py:1335 models.py:1017
#: templates/ishtar/blocks/window_tables/administrativacts.html:10
msgid "Object"
msgstr ""
-#: forms.py:1307 views.py:329
+#: forms.py:1307 views.py:333
msgid "Administrative act search"
msgstr ""
@@ -529,7 +529,7 @@ msgstr ""
msgid "You should select an administrative act."
msgstr ""
-#: forms.py:1338 models.py:1007
+#: forms.py:1338 models.py:1014
msgid "Signature date"
msgstr ""
@@ -564,7 +564,7 @@ msgstr ""
msgid "Generate the associated doc?"
msgstr ""
-#: forms.py:1471 ishtar_menu.py:123 views.py:382
+#: forms.py:1471 ishtar_menu.py:123 views.py:386
msgctxt "admin act register"
msgid "Register"
msgstr ""
@@ -585,7 +585,7 @@ msgstr ""
msgid "Deletion"
msgstr ""
-#: ishtar_menu.py:59 models.py:1026
+#: ishtar_menu.py:59 models.py:1033
#: templates/ishtar/sheet_administrativeact.html:4
msgid "Administrative act"
msgstr ""
@@ -610,434 +610,434 @@ msgstr ""
msgid "General informations"
msgstr ""
-#: ishtar_menu.py:139 models.py:370
+#: ishtar_menu.py:139 models.py:371
#: templates/ishtar/dashboards/dashboard_operation.html:8
msgid "Operations"
msgstr ""
-#: models.py:52 models.py:70 models.py:1861
+#: models.py:53 models.py:71 models.py:1882
msgid "Order"
msgstr ""
-#: models.py:54 models.py:1400
+#: models.py:55 models.py:1421
msgid "End date"
msgstr ""
-#: models.py:55
+#: models.py:56
msgid "Parent period"
msgstr ""
-#: models.py:59
+#: models.py:60
msgid "Type Period"
msgstr ""
-#: models.py:60
+#: models.py:61
msgid "Types Period"
msgstr ""
-#: models.py:73
+#: models.py:74
msgid "Type of report state"
msgstr ""
-#: models.py:74
+#: models.py:75
msgid "Types of report state"
msgstr ""
-#: models.py:97
+#: models.py:98
msgid "Can view all Archaeological sites"
msgstr ""
-#: models.py:99
+#: models.py:100
msgid "Can view own Archaeological site"
msgstr ""
-#: models.py:101
+#: models.py:102
msgid "Can add own Archaeological site"
msgstr ""
-#: models.py:103
+#: models.py:104
msgid "Can change own Archaeological site"
msgstr ""
-#: models.py:105
+#: models.py:106
msgid "Can delete own Archaeological site"
msgstr ""
-#: models.py:142
+#: models.py:143
msgid "Not documented"
msgstr ""
-#: models.py:143
+#: models.py:144
msgid "Arbitrary"
msgstr ""
-#: models.py:144
+#: models.py:145
msgid "Reliable"
msgstr ""
-#: models.py:233
+#: models.py:234
msgid "Year - Index"
msgstr ""
-#: models.py:234
+#: models.py:235
msgid "Associated file (label)"
msgstr ""
-#: models.py:235
+#: models.py:236
msgid "Operator name"
msgstr ""
-#: models.py:236
+#: models.py:237
msgid "Scientist (full name)"
msgstr ""
-#: models.py:237
+#: models.py:238
msgid "Associated file (external ID)"
msgstr ""
-#: models.py:238
+#: models.py:239
msgid "Scientist (title)"
msgstr ""
-#: models.py:239
+#: models.py:240
msgid "Scientist (surname)"
msgstr ""
-#: models.py:240
+#: models.py:241
msgid "Scientist (name)"
msgstr ""
-#: models.py:241
+#: models.py:242
msgid "Scientist - Organization (name)"
msgstr ""
-#: models.py:242
+#: models.py:243
msgid "In charge (title)"
msgstr ""
-#: models.py:243
+#: models.py:244
msgid "In charge (surname)"
msgstr ""
-#: models.py:244
+#: models.py:245
msgid "In charge (name)"
msgstr ""
-#: models.py:245
+#: models.py:246
msgid "In charge - Organization (name)"
msgstr ""
-#: models.py:250
+#: models.py:251
msgid "Archaeological sites (reference)"
msgstr ""
-#: models.py:257
+#: models.py:258
msgid "Closing date"
msgstr ""
-#: models.py:264
+#: models.py:265
msgid "In charge scientist"
msgstr ""
-#: models.py:279 models.py:1196
+#: models.py:280 models.py:1203
msgid "File"
msgstr ""
-#: models.py:283
+#: models.py:284
msgid "Surface (m2)"
msgstr ""
-#: models.py:336
+#: models.py:337
msgid "General comment"
msgstr ""
-#: models.py:339
+#: models.py:340
msgid "Cached name"
msgstr ""
-#: models.py:347
+#: models.py:348
msgid ""
"If checked, it means that this operation have not been officialy registered."
msgstr ""
-#: models.py:363
+#: models.py:364
msgid "Point"
msgstr ""
-#: models.py:364
+#: models.py:365
msgid "Multi polygon"
msgstr ""
-#: models.py:372
+#: models.py:373
msgid "Can view all Operations"
msgstr ""
-#: models.py:373
+#: models.py:374
msgid "Can view own Operation"
msgstr ""
-#: models.py:374
+#: models.py:375
msgid "Can add own Operation"
msgstr ""
-#: models.py:375
+#: models.py:376
msgid "Can change own Operation"
msgstr ""
-#: models.py:376
+#: models.py:377
msgid "Can delete own Operation"
msgstr ""
-#: models.py:377
+#: models.py:378
msgid "Can close Operation"
msgstr ""
-#: models.py:406
+#: models.py:407
msgid "OPE"
msgstr ""
-#: models.py:466
+#: models.py:473
msgid "Intercommunal"
msgstr ""
-#: models.py:498
+#: models.py:505
msgid "Code patriarche"
msgstr ""
-#: models.py:538
+#: models.py:545
msgid "This operation code already exists for this year"
msgstr ""
-#: models.py:563
+#: models.py:570
msgid "Number of parcels"
msgstr ""
-#: models.py:581
+#: models.py:588
msgid "Number of administrative acts"
msgstr ""
-#: models.py:589
+#: models.py:596
msgid "Number of indexed administrative acts"
msgstr ""
-#: models.py:597
+#: models.py:604
msgid "Number of context records"
msgstr ""
-#: models.py:633
+#: models.py:640
msgid "Number of finds"
msgstr ""
-#: models.py:678
+#: models.py:685
msgid "No type"
msgstr ""
-#: models.py:709
+#: models.py:716
msgid "Number of sources"
msgstr ""
-#: models.py:751 templates/ishtar/dashboards/dashboard_operation.html:309
+#: models.py:758 templates/ishtar/dashboards/dashboard_operation.html:309
#: templates/ishtar/dashboards/dashboard_operation.html:575
#: templates/ishtar/dashboards/dashboard_operation.html:611
msgid "Mean"
msgstr ""
-#: models.py:801
+#: models.py:808
msgid "Inverse relation"
msgstr ""
-#: models.py:805
+#: models.py:812
msgid "Operation relation type"
msgstr ""
-#: models.py:806
+#: models.py:813
msgid "Operation relation types"
msgstr ""
-#: models.py:819
+#: models.py:826
msgid "Operation record relation"
msgstr ""
-#: models.py:820
+#: models.py:827
msgid "Operation record relations"
msgstr ""
-#: models.py:866
+#: models.py:873
msgid "Operation documentation"
msgstr ""
-#: models.py:867
+#: models.py:874
msgid "Operation documentations"
msgstr ""
-#: models.py:870
+#: models.py:877
msgid "Can view all Operation sources"
msgstr ""
-#: models.py:872
+#: models.py:879
msgid "Can view own Operation source"
msgstr ""
-#: models.py:874
+#: models.py:881
msgid "Can add own Operation source"
msgstr ""
-#: models.py:876
+#: models.py:883
msgid "Can change own Operation source"
msgstr ""
-#: models.py:878
+#: models.py:885
msgid "Can delete own Operation source"
msgstr ""
-#: models.py:889 models.py:1001
+#: models.py:896 models.py:1008
msgid "Treatment request"
msgstr ""
-#: models.py:890 models.py:1006
+#: models.py:897 models.py:1013
msgid "Treatment"
msgstr ""
-#: models.py:892
+#: models.py:899
msgid "Intended to"
msgstr ""
-#: models.py:894
+#: models.py:901
msgid "Code"
msgstr ""
-#: models.py:897
+#: models.py:904
msgid "Associated template"
msgstr ""
-#: models.py:898
+#: models.py:905
msgid "Indexed"
msgstr ""
-#: models.py:902
+#: models.py:909
msgid "Act types"
msgstr ""
-#: models.py:974
+#: models.py:981
msgid "Person in charge of the operation"
msgstr ""
-#: models.py:980
+#: models.py:987
msgid "Archaeological preventive operator"
msgstr ""
-#: models.py:988
+#: models.py:995
msgid "Signatory"
msgstr ""
-#: models.py:1016
+#: models.py:1023
msgid "Departments"
msgstr ""
-#: models.py:1017
+#: models.py:1024
msgid "Cached values get from associated departments"
msgstr ""
-#: models.py:1020
+#: models.py:1027
msgid "Cached values get from associated towns"
msgstr ""
-#: models.py:1027 templates/ishtar/sheet_operation.html:102
+#: models.py:1034 templates/ishtar/sheet_operation.html:102
#: templates/ishtar/sheet_operation.html:138
msgid "Administrative acts"
msgstr ""
-#: models.py:1030
+#: models.py:1037
msgid "Can view all Administrative acts"
msgstr ""
-#: models.py:1032
+#: models.py:1039
msgid "Can view own Administrative act"
msgstr ""
-#: models.py:1034
+#: models.py:1041
msgid "Can add own Administrative act"
msgstr ""
-#: models.py:1036
+#: models.py:1043
msgid "Can change own Administrative act"
msgstr ""
-#: models.py:1038
+#: models.py:1045
msgid "Can delete own Administrative act"
msgstr ""
-#: models.py:1047
+#: models.py:1054
#: templates/ishtar/blocks/window_tables/administrativacts.html:7
#: templates/ishtar/blocks/window_tables/archaeologicalsites.html:7
msgid "Ref."
msgstr ""
-#: models.py:1141
+#: models.py:1148
msgid "This index already exists for this year"
msgstr ""
-#: models.py:1209
+#: models.py:1216
msgid "External ID"
msgstr ""
-#: models.py:1212
+#: models.py:1219
msgid "External ID is set automatically"
msgstr ""
-#: models.py:1213
+#: models.py:1220
msgid "Address - Locality"
msgstr ""
-#: models.py:1395
+#: models.py:1416
msgid "Owner"
msgstr ""
-#: models.py:1403
+#: models.py:1424
msgid "Parcel owner"
msgstr ""
-#: models.py:1404
+#: models.py:1425
msgid "Parcel owners"
msgstr ""
-#: models.py:1430
+#: models.py:1451
msgid "Recorded"
msgstr ""
-#: models.py:1431
+#: models.py:1452
msgid "Effective"
msgstr ""
-#: models.py:1432
+#: models.py:1453
msgid "Active"
msgstr ""
-#: models.py:1433
+#: models.py:1454
msgid "Field completed"
msgstr ""
-#: models.py:1434
+#: models.py:1455
msgid "Associated report"
msgstr ""
-#: models.py:1435
+#: models.py:1456
msgid "Closed"
msgstr ""
-#: models.py:1436
+#: models.py:1457
msgid "Documented and closed"
msgstr ""
-#: models.py:1862
+#: models.py:1883
msgid "Is preventive"
msgstr ""
-#: models.py:1865
+#: models.py:1886
msgid "Operation type old"
msgstr ""
-#: models.py:1866
+#: models.py:1887
msgid "Operation types old"
msgstr ""
@@ -1045,43 +1045,43 @@ msgstr ""
msgid "New operation"
msgstr ""
-#: views.py:233
+#: views.py:237
msgid "Operation modification"
msgstr ""
-#: views.py:276
+#: views.py:280
msgid "Operation closing"
msgstr ""
-#: views.py:287
+#: views.py:291
msgid "Operation deletion"
msgstr ""
-#: views.py:292
+#: views.py:296
msgid "Operation: source search"
msgstr ""
-#: views.py:300
+#: views.py:304
msgid "Operation: source creation"
msgstr ""
-#: views.py:308
+#: views.py:312
msgid "Operation: source modification"
msgstr ""
-#: views.py:323
+#: views.py:327
msgid "Operation: source deletion"
msgstr ""
-#: views.py:342
+#: views.py:346
msgid "Operation: new administrative act"
msgstr ""
-#: views.py:352
+#: views.py:356
msgid "Operation: administrative act modification"
msgstr ""
-#: views.py:376
+#: views.py:380
msgid "Operation: administrative act deletion"
msgstr ""
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py
index 7c9efaef7..e74d02647 100644
--- a/archaeological_operations/models.py
+++ b/archaeological_operations/models.py
@@ -29,7 +29,8 @@ from django.db.models.signals import post_save, m2m_changed, post_delete
from django.forms import ValidationError
from django.utils.translation import ugettext_lazy as _, ugettext
-from ishtar_common.utils import cached_label_changed, get_cache, mode
+from ishtar_common.utils import cached_label_changed, \
+ force_cached_label_changed, get_cache, mode
from ishtar_common.models import GeneralType, BaseHistorizedItem, \
HistoricalRecords, LightHistorizedItem, OwnPerms, Department, Source,\
@@ -430,13 +431,13 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms,
def get_reference(self, full=False):
ref = ""
if settings.COUNTRY == 'fr' and self.code_patriarche:
- ref = "OA" + unicode(self.code_patriarche)
+ ref = settings.ISHTAR_OPE_PREFIX + unicode(self.code_patriarche)
if not full:
return ref
if self.year and self.operation_code:
if ref:
ref += u" - "
- ref += settings.OP_PREFIX
+ ref += settings.ISHTAR_DEF_OPE_PREFIX
ref += u"-".join((unicode(self.year),
unicode(self.operation_code)))
return ref or "00"
@@ -462,6 +463,12 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms,
def _get_associated_cached_labels(self):
return list(self.context_record.all())
+ def _cached_labels_bulk_update(self):
+ if settings.TESTING and settings.USE_SPATIALITE_FOR_TESTS:
+ return
+ self.context_record.model.cached_label_bulk_update(operation_id=self.pk)
+ return True
+
def get_town_label(self):
lbl = unicode(_('Intercommunal'))
if self.towns.count() == 1:
@@ -517,15 +524,15 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms,
return ""
lbl = unicode(self.operation_code)
year = self.year or 0
- lbl = settings.OP_PREFIX + u"%d-%s%s" % (year, (3 - len(lbl)) * "0",
- lbl)
+ lbl = settings.ISHTAR_DEF_OPE_PREFIX \
+ + u"%d-%s%s" % (year, (3 - len(lbl)) * "0", lbl)
return lbl
@property
def full_code_patriarche(self):
if not self.code_patriarche:
return ''
- return u"OA" + unicode(self.code_patriarche)
+ return settings.ISHTAR_OPE_PREFIX + unicode(self.code_patriarche)
def clean(self):
if not self.operation_code:
@@ -769,7 +776,7 @@ class Operation(ClosedItem, BaseHistorizedItem, ImageModel, OwnPerms,
return super(Operation, self).save(*args, **kwargs)
-m2m_changed.connect(cached_label_changed, sender=Operation.towns.through)
+m2m_changed.connect(force_cached_label_changed, sender=Operation.towns.through)
def operation_post_save(sender, **kwargs):
@@ -1359,24 +1366,38 @@ def parcel_post_save(sender, **kwargs):
parcel = kwargs['instance']
created = kwargs.get('created', None)
+ updated = False
# remove when the parcel is linked to nothing
- if not getattr(parcel, '_updated_id', None) and not created and not \
- parcel.operation and not parcel.associated_file:
- parcel.delete()
- return
+ if not getattr(parcel, '_updated_id', None) and not created \
+ and not parcel.operation and not parcel.associated_file:
+ if parcel.context_record.count():
+ # trying to restore a lost parcel
+ parcel.operation = parcel.context_record.all()[0].operation
+ updated = True
+ else:
+ parcel.delete()
+ return
- updated = False
if not parcel.external_id or parcel.auto_external_id:
external_id = get_external_id('parcel_external_id', parcel)
if external_id != parcel.external_id:
updated = True
+ parcel._updated_id = True
parcel.auto_external_id = True
parcel.external_id = external_id
if updated:
- parcel._updated_id = True
parcel.save()
return
+ if parcel.context_record.count():
+ if settings.TESTING and settings.USE_SPATIALITE_FOR_TESTS:
+ for cr in parcel.context_record.all():
+ cr.skip_history_when_saving = True
+ cr.save()
+ else:
+ parcel.context_record.model.cached_label_bulk_update(
+ parcel_id=parcel.id)
+
if parcel.operation and parcel.operation.pk and \
parcel.town not in list(parcel.operation.towns.all()):
parcel.operation.towns.add(parcel.town)
diff --git a/archaeological_operations/tests.py b/archaeological_operations/tests.py
index 364cc4c8e..23c32434b 100644
--- a/archaeological_operations/tests.py
+++ b/archaeological_operations/tests.py
@@ -26,7 +26,6 @@ import datetime
from django.conf import settings
from django.core.files.uploadedfile import SimpleUploadedFile
from django.core.urlresolvers import reverse
-from django.test import TestCase
from django.test.client import Client
from django.contrib.auth.models import Permission
@@ -41,7 +40,7 @@ from archaeological_context_records.models import Unit
from ishtar_common import forms_common
from ishtar_common.tests import WizardTest, WizardTestFormData as FormData, \
- create_superuser, create_user
+ create_superuser, create_user, TestCase
class ImportTest(object):
@@ -607,6 +606,9 @@ class OperationInitTest(object):
def create_parcel(self, data={}):
default = {'town': self.get_default_town(),
'section': 'A', 'parcel_number': '1'}
+ if not hasattr(self, 'operations'):
+ self.create_operation()
+ default['operation'] = self.operations[0]
default.update(data)
if not getattr(self, 'parcels', None):
self.parcels = []
@@ -616,7 +618,11 @@ class OperationInitTest(object):
def get_default_parcel(self, force=False):
if force:
return self.create_parcel()[-1]
- return self.create_parcel()[0]
+ parcel = self.create_parcel()[0]
+ if models.Parcel.objects.filter(pk=parcel.pk).count():
+ return parcel
+ self.parcels.pop(0)
+ return self.create_operation()[-1]
def create_operation(self, user=None, orga=None):
if not orga:
@@ -631,7 +637,12 @@ class OperationInitTest(object):
def get_default_operation(self, force=False):
if force:
return self.create_operation()[-1]
- return self.create_operation()[0]
+ ope = self.create_operation()[0]
+ if models.Operation.objects.filter(pk=ope.pk).count():
+ return ope
+ self.operations.pop(0)
+ return self.create_operation()[-1]
+
def tearDown(self):
# cleanup for further test
@@ -741,6 +752,107 @@ class OperationTest(TestCase, OperationInitTest):
ope2 = create_operation(self.user, values={'year': 0})
self.assertEqual(ope2.operation_code, 2)
+ def test_cache_update(self):
+ self.create_towns()
+ operation = self.operations[0]
+ town, ope_id = operation.cached_label.split(' | ')
+ self.assertIn(town, (u'Intercommunal', u"Multi-town"))
+ self.assertEqual(ope_id, 'OP2010-1')
+ operation = models.Operation.objects.get(pk=operation.pk)
+ operation.year = 2011
+ operation.save()
+ operation.towns.add(self.towns[0])
+ operation = models.Operation.objects.get(pk=operation.pk)
+ town, ope_id = operation.cached_label.split(' | ')
+ self.assertEqual(ope_id, 'OP2011-1')
+ self.assertEqual(town, self.towns[0].name)
+
+ def test_cache_bulk_update(self):
+ if settings.USE_SPATIALITE_FOR_TESTS:
+ # using views - can only be tested with postgresql
+ return
+
+ operation = self.operations[0]
+ init_parcel = self.create_parcel()[0]
+ operation.parcels.add(init_parcel)
+
+ from archaeological_context_records.models import ContextRecord
+ cr_data = {'label': "Context record", "operation": operation,
+ 'parcel': init_parcel,
+ 'history_modifier': self.get_default_user()}
+ cr = ContextRecord.objects.create(**cr_data)
+
+ from archaeological_finds.models import BaseFind, Find, MaterialType
+ bf_data = {
+ 'label': "Base find", 'history_modifier': self.get_default_user(),
+ 'context_record': cr
+ }
+ base_find = BaseFind.objects.create(**bf_data)
+ find = Find.objects.create(
+ history_modifier=self.get_default_user(),
+ label='Find me'
+ )
+ find.base_finds.add(base_find)
+ mat = MaterialType.objects.create(
+ label='Adamentium', txt_idx='admentium', code='ADA')
+ find.material_types.add(mat)
+
+ class TestObj(object):
+ def __init__(self):
+ self.context_record_reached = []
+
+ def reached(self, sender, **kwargs):
+ instance = kwargs.get('instance')
+ if sender == ContextRecord:
+ self.context_record_reached.append(instance)
+
+ test_obj = TestObj()
+ operation = models.Operation.objects.get(pk=operation.pk)
+ operation.test_obj = test_obj
+ operation.year = 2011
+ operation.save()
+ # bulk update of context records cached label gen don't have to be
+ # reached
+ self.assertEqual(len(test_obj.context_record_reached), 0)
+
+ # verify the relevance of the update
+ cr = ContextRecord.objects.get(pk=cr.pk)
+ ope_id, parcel_sec, parcel_nb, cr_label = cr.cached_label.split(' | ')
+ self.assertEqual(ope_id, '{}2011-1'.format(
+ settings.ISHTAR_DEF_OPE_PREFIX))
+
+ base_find = BaseFind.objects.get(pk=base_find.pk)
+ op_code, idx = base_find.cache_short_id.split(' | ')
+ self.assertEqual(op_code, 'OP2011-1')
+ self.assertEqual(idx, '00001')
+ op_code, mat_code, lbl, idx = base_find.cache_complete_id.split(' | ')
+ self.assertEqual(op_code, 'OP2011-1')
+ self.assertEqual(mat_code, 'ADA')
+ self.assertEqual(lbl, 'Context record')
+ self.assertEqual(idx, '00001')
+
+ find = Find.objects.get(pk=find.pk)
+ op_code_idx, lbl = find.cached_label.split(' | ')
+ self.assertEqual(op_code_idx, 'OP2011-1-00001')
+ self.assertEqual(lbl, 'Find me')
+
+ operation = models.Operation.objects.get(pk=operation.pk)
+ operation.code_patriarche = '666'
+ operation.save()
+ cr = ContextRecord.objects.get(pk=cr.pk)
+ ope_id, parcel_sec, parcel_nb, cr_label = cr.cached_label.split(' | ')
+ self.assertEqual(ope_id, '{}666'.format(settings.ISHTAR_OPE_PREFIX))
+
+ base_find = BaseFind.objects.get(pk=base_find.pk)
+ op_code, idx = base_find.cache_short_id.split(' | ')
+ self.assertEqual(op_code, 'OA666')
+ op_code, mat_code, lbl, idx = base_find.cache_complete_id.split(' | ')
+ self.assertEqual(op_code, 'OA666')
+
+ find = Find.objects.get(pk=find.pk)
+ op_code_idx, lbl = find.cached_label.split(' | ')
+ self.assertEqual(op_code_idx, 'OA666-00001')
+
class OperationSearchTest(TestCase, OperationInitTest):
fixtures = [settings.ROOT_PATH +
@@ -958,6 +1070,158 @@ class OperationWizardCreationTest(WizardTest, OperationInitTest, TestCase):
self.parcel_number + 2)
+class OperationWizardModifTest(WizardTest, OperationInitTest, TestCase):
+ fixtures = OperationWizardCreationTest.fixtures
+ url_name = 'operation_modification'
+ wizard_name = url_name + '_wizard'
+ steps = views.operation_modif_wizard_steps
+ base_ignored_steps = (
+ 'archaeologicalsite-operation_modification',
+ 'preventive-operation_modification',
+ 'preventivediag-operation_modification',
+ 'towns-operation_modification',
+ 'parcels-operation_modification',
+ 'remains-operation_modification',
+ 'periods-operation_modification',
+ 'relations-operation_modification',
+ 'abstract-operation_modification',)
+ form_datas = [
+ FormData(
+ "Update an operation",
+ form_datas={
+ 'selec-operation_modification': {},
+ 'general-operation_modification': {
+ 'operation_type': 2,
+ 'year': 2017},
+ 'townsgeneral-operation_modification': [],
+ 'parcelsgeneral-operation_modification': [],
+ },
+ ignored=base_ignored_steps
+ ),
+ FormData(
+ "Operation: try to remove a parcel with attached context record",
+ form_datas={
+ 'selec-operation_modification': {},
+ 'general-operation_modification': {
+ 'operation_type': 2,
+ 'year': 2017},
+ 'townsgeneral-operation_modification': [],
+ 'parcelsgeneral-operation_modification': [],
+ },
+ ignored=base_ignored_steps
+ ),
+ FormData(
+ "Operation: remove a parcel with no attached context record",
+ form_datas={
+ 'selec-operation_modification': {},
+ 'general-operation_modification': {
+ 'operation_type': 2,
+ 'year': 2017},
+ 'townsgeneral-operation_modification': [],
+ 'parcelsgeneral-operation_modification': [],
+ },
+ ignored=base_ignored_steps
+ ),
+ ]
+
+ def pre_wizard(self):
+ self.create_operation()
+ operation = self.operations[0]
+ init_town = self.create_towns()[0]
+ operation.towns.add(init_town)
+ init_parcel = self.create_parcel()[0]
+ operation.parcels.add(init_parcel)
+
+ from archaeological_context_records.models import ContextRecord
+ cr_data = {'label': "Context record", "operation": operation,
+ 'parcel': init_parcel,
+ 'history_modifier': self.get_default_user()}
+ self.cr = ContextRecord.objects.create(**cr_data)
+
+ data = self.form_datas[0].form_datas
+ data2 = self.form_datas[1].form_datas
+ data3 = self.form_datas[2].form_datas
+
+ data['selec-operation_modification']['pk'] = operation.pk
+ data2['selec-operation_modification']['pk'] = operation.pk
+ data3['selec-operation_modification']['pk'] = operation.pk
+
+ town = self.create_towns(
+ datas={'numero_insee': '67890', 'name': 'Twin Peaks'})[-1]
+ towns = [{'town': town.pk}, {'town': init_town.pk}]
+ data['townsgeneral-operation_modification'] = towns
+ data2['townsgeneral-operation_modification'] = towns
+ data3['townsgeneral-operation_modification'] = towns
+
+ parcel_data = {
+ 'town': town.pk, 'year': 2017, 'section': 'S',
+ 'parcel_number': '42'}
+ data['parcelsgeneral-operation_modification'].append(parcel_data)
+ data2['parcelsgeneral-operation_modification'].append(parcel_data)
+ data3['parcelsgeneral-operation_modification'].append(parcel_data)
+
+ parcel_data_2 = {
+ 'town': init_parcel.town.pk, 'year': init_parcel.year or '',
+ 'section': init_parcel.section,
+ 'parcel_number': init_parcel.parcel_number}
+ data['parcelsgeneral-operation_modification'].append(parcel_data_2)
+ # no init parcel for data2 and data3
+
+ self.operation_number = models.Operation.objects.count()
+ self.parcel_number = models.Parcel.objects.count()
+
+ def post_first_wizard(test_object, final_step_response):
+ test_object.assertEqual(models.Operation.objects.count(),
+ test_object.operation_number)
+ operation = models.Operation.objects.get(
+ pk=test_object.operations[0].pk)
+ test_object.assertEqual(operation.operation_type.pk, 2)
+ test_object.assertEqual(operation.year, 2017)
+ test_object.assertEqual(models.Parcel.objects.count(),
+ test_object.parcel_number + 1)
+ test_object.assertEqual(operation.parcels.count(),
+ test_object.parcel_number + 1)
+
+ def post_second_wizard(test_object, final_step_response):
+ test_object.assertEqual(models.Operation.objects.count(),
+ test_object.operation_number)
+ operation = models.Operation.objects.get(
+ pk=test_object.operations[0].pk)
+ test_object.assertEqual(operation.operation_type.pk, 2)
+ test_object.assertEqual(operation.year, 2017)
+ test_object.assertEqual(models.Parcel.objects.count(),
+ test_object.parcel_number + 1)
+ # the init parcel is not submited but have a context record
+ # the init parcel is not detached from the operation
+ test_object.assertEqual(operation.parcels.count(),
+ test_object.parcel_number + 1)
+
+ def pre_third_wizard(test_object):
+ parcel_nb = models.Parcel.objects.count()
+ test_object.cr.delete()
+ test_object.assertEqual(
+ parcel_nb, models.Parcel.objects.count())
+
+ def post_third_wizard(test_object, final_step_response):
+ test_object.assertEqual(models.Operation.objects.count(),
+ test_object.operation_number)
+ operation = models.Operation.objects.get(
+ pk=test_object.operations[0].pk)
+ test_object.assertEqual(operation.operation_type.pk, 2)
+ test_object.assertEqual(operation.year, 2017)
+ # with no attach the parcel is deleted
+ test_object.assertEqual(operation.parcels.count(),
+ test_object.parcel_number)
+ test_object.assertEqual(models.Parcel.objects.count(),
+ test_object.parcel_number)
+
+ self.form_datas[0].extra_tests = [post_first_wizard]
+ self.form_datas[1].extra_tests = [post_second_wizard]
+ self.form_datas[2].pre_tests = [pre_third_wizard]
+ self.form_datas[2].extra_tests = [post_third_wizard]
+ super(OperationWizardModifTest, self).pre_wizard()
+
+
class OperationWizardDeleteTest(OperationWizardCreationTest):
fixtures = OperationWizardCreationTest.fixtures
url_name = 'operation_deletion'
diff --git a/archaeological_operations/views.py b/archaeological_operations/views.py
index 005fae0db..c4e4acb5e 100644
--- a/archaeological_operations/views.py
+++ b/archaeological_operations/views.py
@@ -49,9 +49,9 @@ def autocomplete_patriarche(request, non_closed=True):
q = request.GET.get('term')
query = Q()
for q in q.split(' '):
- query = query & Q(code_patriarche__startswith=q)
+ query &= Q(code_patriarche__startswith=q)
if non_closed:
- query = query & Q(end_date__isnull=True)
+ query &= Q(end_date__isnull=True)
limit = 15
operations = models.Operation.objects\
.filter(query).order_by('code_patriarche')[:limit]
@@ -113,12 +113,12 @@ def autocomplete_operation(request, non_closed=True):
q = q[2:]
try:
int(q)
- extra = extra | Q(code_patriarche__contains=q)
+ extra |= Q(code_patriarche__contains=q)
except ValueError:
pass
query = query & extra
if non_closed:
- query = query & Q(end_date__isnull=True)
+ query &= Q(end_date__isnull=True)
limit = 15
operations = models.Operation.objects.filter(query)[:limit]
data = json.dumps([{'id': operation.pk, 'value': unicode(operation)}
@@ -215,7 +215,7 @@ operation_creation_wizard = OperationWizard.as_view(
condition_dict=ope_crea_condition_dict,
url_name='operation_creation',)
-operation_modification_wizard = OperationModificationWizard.as_view([
+operation_modif_wizard_steps = [
('selec-operation_modification', OperationFormSelection),
('general-operation_modification', OperationFormModifGeneral),
('archaeologicalsite-operation_modification', ArchaeologicalSiteFormSet),
@@ -229,7 +229,11 @@ operation_modification_wizard = OperationModificationWizard.as_view([
('periods-operation_modification', PeriodForm),
('relations-operation_modification', RecordRelationsFormSet),
('abstract-operation_modification', OperationFormAbstract),
- ('final-operation_modification', FinalForm)],
+ ('final-operation_modification', FinalForm)
+]
+
+operation_modification_wizard = OperationModificationWizard.as_view(
+ operation_modif_wizard_steps,
label=_(u"Operation modification"),
condition_dict={
'preventive-operation_modification': is_preventive(