diff options
Diffstat (limited to 'archaeological_operations')
| -rw-r--r-- | archaeological_operations/forms.py | 35 | ||||
| -rw-r--r-- | archaeological_operations/locale/django.pot | 238 | ||||
| -rw-r--r-- | archaeological_operations/utils.py | 4 |
3 files changed, 144 insertions, 133 deletions
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py index d524fdbc5..247dcc20a 100644 --- a/archaeological_operations/forms.py +++ b/archaeological_operations/forms.py @@ -45,7 +45,8 @@ from widgets import ParcelWidget, SelectParcelWidget, OAWidget from ishtar_common import widgets from ishtar_common.forms import FinalForm, FormSet, get_now, \ - reverse_lazy, get_form_selection, TableSelect, get_data_from_formset + reverse_lazy, get_form_selection, TableSelect, get_data_from_formset, \ + ManageOldType from ishtar_common.forms_common import TownFormSet, SourceForm, SourceSelect, \ get_town_field @@ -368,7 +369,7 @@ ParcelFormSet = formset_factory(ParcelForm, can_delete=True, ParcelFormSet.form_label = _(u"Parcels") -class RecordRelationsForm(forms.Form): +class RecordRelationsForm(ManageOldType, forms.Form): base_model = 'right_relation' current_model = models.RelationType current_related_model = models.Operation @@ -386,7 +387,8 @@ class RecordRelationsForm(forms.Form): def __init__(self, *args, **kwargs): super(RecordRelationsForm, self).__init__(*args, **kwargs) self.fields['relation_type'].choices = \ - models.RelationType.get_types() + models.RelationType.get_types( + initial=self.init_data.get('relation_type')) @classmethod def _format_lst(cls, current): @@ -709,7 +711,7 @@ class DashboardForm(forms.Form): return fltr -class OperationFormGeneral(forms.Form): +class OperationFormGeneral(ManageOldType, forms.Form): form_label = _(u"General") base_model = 'archaeological_site' associated_models = {'scientist': Person, @@ -804,11 +806,13 @@ class OperationFormGeneral(forms.Form): def __init__(self, *args, **kwargs): super(OperationFormGeneral, self).__init__(*args, **kwargs) self.fields['operation_type'].choices = \ - models.OperationType.get_types() + models.OperationType.get_types( + initial=self.init_data.get('operation_type')) self.fields['operation_type'].help_text = \ models.OperationType.get_help() self.fields['report_processing'].choices = \ - models.ReportState.get_types() + models.ReportState.get_types( + initial=self.init_data.get('report_processing')) self.fields['report_processing'].help_text = \ models.ReportState.get_help() self.fields['record_quality'].choices = \ @@ -1003,7 +1007,7 @@ class SelectedParcelFormSet(forms.Form): """ -class RemainForm(forms.Form): +class RemainForm(ManageOldType, forms.Form): form_label = _("Remain types") base_model = 'remain' associated_models = {'remain': models.RemainType} @@ -1014,11 +1018,12 @@ class RemainForm(forms.Form): def __init__(self, *args, **kwargs): super(RemainForm, self).__init__(*args, **kwargs) self.fields['remain'].choices = models.RemainType.get_types( + initial=self.init_data.get('remain'), empty_first=False) self.fields['remain'].help_text = models.RemainType.get_help() -class PeriodForm(forms.Form): +class PeriodForm(ManageOldType, forms.Form): form_label = _("Periods") base_model = 'period' associated_models = {'period': models.Period} @@ -1029,11 +1034,12 @@ class PeriodForm(forms.Form): def __init__(self, *args, **kwargs): super(PeriodForm, self).__init__(*args, **kwargs) self.fields['period'].choices = models.Period.get_types( + initial=self.init_data.get('period'), empty_first=False) self.fields['period'].help_text = models.Period.get_help() -class ArchaeologicalSiteForm(forms.Form): +class ArchaeologicalSiteForm(ManageOldType, forms.Form): reference = forms.CharField(label=_(u"Reference"), max_length=20) name = forms.CharField(label=_(u"Name"), max_length=200, required=False) periods = forms.MultipleChoiceField( @@ -1049,10 +1055,14 @@ class ArchaeologicalSiteForm(forms.Form): kwargs.pop('limits') super(ArchaeologicalSiteForm, self).__init__(*args, **kwargs) self.fields['periods'].choices = \ - models.Period.get_types(empty_first=False) + models.Period.get_types( + empty_first=False, + initial=self.init_data.get('periods')) self.fields['periods'].help_text = models.Period.get_help() self.fields['remains'].choices = \ - models.RemainType.get_types(empty_first=False) + models.RemainType.get_types( + initial=self.init_data.get('remains'), + empty_first=False) self.fields['remains'].help_text = models.RemainType.get_help() def clean_reference(self): @@ -1260,7 +1270,7 @@ class AdministrativeActOpeFormSelection(forms.Form): return cleaned_data -class AdministrativeActOpeForm(forms.Form): +class AdministrativeActOpeForm(ManageOldType, forms.Form): form_label = _("General") associated_models = {'act_type': models.ActType, } # 'signatory':Person} @@ -1280,6 +1290,7 @@ class AdministrativeActOpeForm(forms.Form): def __init__(self, *args, **kwargs): super(AdministrativeActOpeForm, self).__init__(*args, **kwargs) self.fields['act_type'].choices = models.ActType.get_types( + initial=self.init_data.get('act_type'), dct={'intented_to': 'O'}) self.fields['act_type'].help_text = models.ActType.get_help( dct={'intented_to': 'O'}) diff --git a/archaeological_operations/locale/django.pot b/archaeological_operations/locale/django.pot index 7c2ea0d62..5a84d8c91 100644 --- a/archaeological_operations/locale/django.pot +++ b/archaeological_operations/locale/django.pot @@ -8,12 +8,12 @@ msgid "" msgstr "" -#: forms.py:66 forms.py:368 forms.py:952 forms.py:974 forms.py:978 +#: forms.py:67 forms.py:369 forms.py:956 forms.py:978 forms.py:982 #: models.py:815 templates/ishtar/blocks/window_tables/parcels.html:10 msgid "Parcels" msgstr "" -#: forms.py:69 forms.py:202 forms.py:928 models.py:801 +#: forms.py:70 forms.py:203 forms.py:932 models.py:801 #: templates/ishtar/blocks/window_tables/parcels.html:7 #: templates/ishtar/dashboards/dashboard_operation.html:432 #: templates/ishtar/dashboards/dashboard_operation.html:446 @@ -22,92 +22,92 @@ msgstr "" msgid "Town" msgstr "" -#: forms.py:71 forms.py:457 forms.py:731 forms.py:1192 models.py:194 +#: forms.py:72 forms.py:459 forms.py:733 forms.py:1202 models.py:194 #: models.py:618 models.py:799 #: templates/ishtar/blocks/window_tables/parcels.html:8 msgid "Year" msgstr "" -#: forms.py:74 models.py:802 +#: forms.py:75 models.py:802 #: templates/ishtar/blocks/window_tables/parcels.html:9 msgid "Section" msgstr "" -#: forms.py:77 models.py:804 +#: forms.py:78 models.py:804 msgid "Parcel number" msgstr "" -#: forms.py:79 models.py:806 models.py:823 models.py:872 +#: forms.py:80 models.py:806 models.py:823 models.py:872 msgid "Public domain" msgstr "" -#: forms.py:123 +#: forms.py:124 msgid "Town section is required." msgstr "" -#: forms.py:167 +#: forms.py:168 msgid "Current parcels" msgstr "" -#: forms.py:169 +#: forms.py:170 msgid "Deleted parcels" msgstr "" -#: forms.py:205 +#: forms.py:206 msgid "Full text input" msgstr "" -#: forms.py:207 +#: forms.py:208 msgid "example: \"2013: XD:1 to 13,24,33 to 39, YD:24\" or \"AB:24,AC:42\"" msgstr "" -#: forms.py:362 +#: forms.py:363 msgid "There are identical parcels." msgstr "" -#: forms.py:377 +#: forms.py:378 msgid "Relation type" msgstr "" -#: forms.py:380 ishtar_menu.py:30 models.py:276 models.py:518 models.py:543 +#: forms.py:381 ishtar_menu.py:30 models.py:276 models.py:518 models.py:543 #: models.py:559 models.py:610 models.py:798 wizards.py:338 wizards.py:349 #: templates/ishtar/sheet_operation.html:4 msgid "Operation" msgstr "" -#: forms.py:399 +#: forms.py:401 msgid ":" msgstr "" -#: forms.py:407 forms.py:585 forms.py:1157 +#: forms.py:409 forms.py:587 forms.py:1167 msgid "You should select an operation." msgstr "" -#: forms.py:411 +#: forms.py:413 msgid "You should select a relation type." msgstr "" -#: forms.py:441 +#: forms.py:443 msgid "Current relations" msgstr "" -#: forms.py:443 +#: forms.py:445 msgid "Deleted relations" msgstr "" -#: forms.py:447 templates/ishtar/sheet_operation.html:114 +#: forms.py:449 templates/ishtar/sheet_operation.html:114 msgid "Relations" msgstr "" -#: forms.py:458 forms.py:1163 +#: forms.py:460 forms.py:1173 msgid "Numeric reference" msgstr "" -#: forms.py:464 forms.py:1203 +#: forms.py:466 forms.py:1213 msgid "Parcel (section/number/public domain)" msgstr "" -#: forms.py:467 forms.py:1206 models.py:519 +#: forms.py:469 forms.py:1216 models.py:519 #: templates/ishtar/dashboards/dashboard_operation.html:390 #: templates/ishtar/dashboards/dashboard_operation.html:411 #: templates/ishtar/dashboards/dashboard_operation.html:643 @@ -115,404 +115,404 @@ msgstr "" msgid "Department" msgstr "" -#: forms.py:468 forms.py:1038 models.py:78 +#: forms.py:470 forms.py:1044 models.py:78 #: templates/ishtar/blocks/window_tables/archaeologicalsites.html:8 msgid "Name" msgstr "" -#: forms.py:470 forms.py:652 forms.py:729 forms.py:1169 models.py:202 +#: forms.py:472 forms.py:654 forms.py:731 forms.py:1179 models.py:202 msgid "Operation type" msgstr "" -#: forms.py:472 +#: forms.py:474 msgid "Is open?" msgstr "" -#: forms.py:481 forms.py:758 models.py:191 +#: forms.py:483 forms.py:760 models.py:191 msgid "In charge" msgstr "" -#: forms.py:488 models.py:604 +#: forms.py:490 models.py:604 msgid "Scientist in charge" msgstr "" -#: forms.py:490 forms.py:654 forms.py:749 models.py:189 +#: forms.py:492 forms.py:656 forms.py:751 models.py:189 msgid "Operator" msgstr "" -#: forms.py:497 forms.py:1043 models.py:82 models.py:204 +#: forms.py:499 forms.py:1049 models.py:82 models.py:204 #: templates/ishtar/blocks/window_tables/archaeologicalsites.html:10 msgid "Remains" msgstr "" -#: forms.py:498 forms.py:1022 forms.py:1040 models.py:80 models.py:209 +#: forms.py:500 forms.py:1027 forms.py:1046 models.py:80 models.py:209 #: templates/ishtar/blocks/window_tables/archaeologicalsites.html:9 msgid "Periods" msgstr "" -#: forms.py:499 +#: forms.py:501 msgid "Started before" msgstr "" -#: forms.py:501 +#: forms.py:503 msgid "Started after" msgstr "" -#: forms.py:503 +#: forms.py:505 msgid "Ended before" msgstr "" -#: forms.py:505 +#: forms.py:507 msgid "Ended after" msgstr "" -#: forms.py:508 +#: forms.py:510 msgid "Search within relations" msgstr "" -#: forms.py:510 forms.py:797 models.py:255 +#: forms.py:512 forms.py:799 models.py:255 msgid "Comment" msgstr "" -#: forms.py:511 +#: forms.py:513 msgid "Abstract (full text search)" msgstr "" -#: forms.py:512 forms.py:799 models.py:267 +#: forms.py:514 forms.py:801 models.py:267 msgid "Record quality" msgstr "" -#: forms.py:513 forms.py:781 models.py:221 +#: forms.py:515 forms.py:783 models.py:221 msgid "Report processing" msgstr "" -#: forms.py:515 forms.py:802 models.py:262 +#: forms.py:517 forms.py:804 models.py:262 msgid "Virtual operation" msgstr "" -#: forms.py:517 forms.py:1083 +#: forms.py:519 forms.py:1093 msgid "Archaelogical site" msgstr "" -#: forms.py:523 forms.py:1210 +#: forms.py:525 forms.py:1220 msgid "Created by" msgstr "" -#: forms.py:529 forms.py:1216 +#: forms.py:531 forms.py:1226 msgid "Modified by" msgstr "" -#: forms.py:572 forms.py:1155 views.py:247 +#: forms.py:574 forms.py:1165 views.py:247 msgid "Operation search" msgstr "" -#: forms.py:616 +#: forms.py:618 msgid "Associated file" msgstr "" -#: forms.py:620 forms.py:876 models.py:615 wizards.py:76 +#: forms.py:622 forms.py:880 models.py:615 wizards.py:76 msgid "Archaelogical file" msgstr "" -#: forms.py:627 forms.py:629 models.py:269 +#: forms.py:629 forms.py:631 models.py:269 msgid "Abstract" msgstr "" -#: forms.py:632 +#: forms.py:634 msgid "months" msgstr "" -#: forms.py:632 +#: forms.py:634 msgid "years" msgstr "" -#: forms.py:634 models.py:175 +#: forms.py:636 models.py:175 msgid "Creation date" msgstr "" -#: forms.py:635 +#: forms.py:637 msgid "Start of field work" msgstr "" -#: forms.py:637 +#: forms.py:639 msgid "All" msgstr "" -#: forms.py:638 +#: forms.py:640 msgid "Preventive" msgstr "" -#: forms.py:639 +#: forms.py:641 msgid "Research" msgstr "" -#: forms.py:643 +#: forms.py:645 msgid "Slicing" msgstr "" -#: forms.py:646 +#: forms.py:648 msgid "Department detail" msgstr "" -#: forms.py:648 +#: forms.py:650 msgid "Date get from" msgstr "" -#: forms.py:650 +#: forms.py:652 msgid "Preventive/Research" msgstr "" -#: forms.py:656 +#: forms.py:658 msgid "Date after" msgstr "" -#: forms.py:658 +#: forms.py:660 msgid "Date before" msgstr "" -#: forms.py:660 +#: forms.py:662 msgid "With reports" msgstr "" -#: forms.py:661 +#: forms.py:663 msgid "With finds" msgstr "" -#: forms.py:713 forms.py:1264 templates/ishtar/sheet_administrativeact.html:13 +#: forms.py:715 forms.py:1274 templates/ishtar/sheet_administrativeact.html:13 #: templates/ishtar/sheet_operation.html:30 msgid "General" msgstr "" -#: forms.py:727 models.py:254 +#: forms.py:729 models.py:254 msgid "Generic name" msgstr "" -#: forms.py:736 models.py:223 +#: forms.py:738 models.py:223 msgid "Old code" msgstr "" -#: forms.py:739 +#: forms.py:741 msgid "Head scientist" msgstr "" -#: forms.py:755 models.py:253 +#: forms.py:757 models.py:253 msgid "Operator reference" msgstr "" -#: forms.py:767 +#: forms.py:769 msgid "Total surface (m2)" msgstr "" -#: forms.py:774 models.py:50 models.py:178 models.py:988 +#: forms.py:776 models.py:50 models.py:178 models.py:988 msgid "Start date" msgstr "" -#: forms.py:776 models.py:180 +#: forms.py:778 models.py:180 msgid "Excavation end date" msgstr "" -#: forms.py:779 models.py:181 +#: forms.py:781 models.py:181 msgid "Report delivery date" msgstr "" -#: forms.py:829 +#: forms.py:833 msgid "" "If you want to set an excavation end date you have to provide a start date." msgstr "" -#: forms.py:834 +#: forms.py:838 msgid "The excavation end date cannot be before the start date." msgstr "" -#: forms.py:862 +#: forms.py:866 #, python-format msgid "" "Operation code already exist for year: %(year)d - use a value bigger than " "%(last_val)d" msgstr "" -#: forms.py:866 +#: forms.py:870 msgid "Bad operation code" msgstr "" -#: forms.py:872 models.py:195 models.py:405 +#: forms.py:876 models.py:195 models.py:405 msgid "Operation code" msgstr "" -#: forms.py:898 +#: forms.py:902 msgid "Preventive informations - excavation" msgstr "" -#: forms.py:899 models.py:207 +#: forms.py:903 models.py:207 #: templates/ishtar/dashboards/dashboard_operation.html:699 msgid "Cost (euros)" msgstr "" -#: forms.py:900 models.py:212 +#: forms.py:904 models.py:212 msgid "Scheduled man-days" msgstr "" -#: forms.py:902 models.py:215 +#: forms.py:906 models.py:215 msgid "Optional man-days" msgstr "" -#: forms.py:904 models.py:218 +#: forms.py:908 models.py:218 msgid "Effective man-days" msgstr "" -#: forms.py:914 +#: forms.py:918 msgid "Preventive informations - diagnostic" msgstr "" -#: forms.py:917 models.py:237 +#: forms.py:921 models.py:237 msgid "Prescription on zoning" msgstr "" -#: forms.py:919 models.py:240 +#: forms.py:923 models.py:240 msgid "Prescription on large area" msgstr "" -#: forms.py:922 models.py:242 +#: forms.py:926 models.py:242 msgid "Prescription on geoarchaeological context" msgstr "" -#: forms.py:926 forms.py:948 models.py:206 models.py:628 +#: forms.py:930 forms.py:952 models.py:206 models.py:628 msgid "Towns" msgstr "" -#: forms.py:955 models.py:814 models.py:986 +#: forms.py:959 models.py:814 models.py:986 msgid "Parcel" msgstr "" -#: forms.py:1007 models.py:44 +#: forms.py:1011 models.py:44 msgid "Remain types" msgstr "" -#: forms.py:1011 models.py:43 +#: forms.py:1015 models.py:43 msgid "Remain type" msgstr "" -#: forms.py:1026 +#: forms.py:1031 msgid "Period" msgstr "" -#: forms.py:1037 models.py:77 +#: forms.py:1043 models.py:77 msgid "Reference" msgstr "" -#: forms.py:1062 +#: forms.py:1072 msgid "This reference already exists." msgstr "" -#: forms.py:1079 models.py:86 +#: forms.py:1089 models.py:86 msgid "Archaeological site" msgstr "" -#: forms.py:1094 models.py:87 models.py:259 +#: forms.py:1104 models.py:87 models.py:259 #: templates/ishtar/sheet_operation.html:125 msgid "Archaeological sites" msgstr "" -#: forms.py:1098 +#: forms.py:1108 msgid "Associated archaelogical sites" msgstr "" -#: forms.py:1104 ishtar_menu.py:33 ishtar_menu.py:63 ishtar_menu.py:92 +#: forms.py:1114 ishtar_menu.py:33 ishtar_menu.py:63 ishtar_menu.py:92 msgid "Search" msgstr "" -#: forms.py:1109 +#: forms.py:1119 msgid "Would you like to close this operation?" msgstr "" -#: forms.py:1114 +#: forms.py:1124 msgid "Would you like to delete this operation?" msgstr "" -#: forms.py:1123 forms.py:1193 forms.py:1328 models.py:545 models.py:595 +#: forms.py:1133 forms.py:1203 forms.py:1339 models.py:545 models.py:595 msgid "Index" msgstr "" -#: forms.py:1149 +#: forms.py:1159 #, python-format msgid "" "Index already exists for operation: %(operation)s - use a value bigger than " "%(last_val)d" msgstr "" -#: forms.py:1161 +#: forms.py:1171 msgid "Operation's year" msgstr "" -#: forms.py:1168 +#: forms.py:1178 msgid "Operation's town" msgstr "" -#: forms.py:1181 +#: forms.py:1191 msgid "Documentation search" msgstr "" -#: forms.py:1183 +#: forms.py:1193 msgid "You should select a document." msgstr "" -#: forms.py:1200 forms.py:1267 models.py:570 models.py:589 +#: forms.py:1210 forms.py:1277 models.py:570 models.py:589 msgid "Act type" msgstr "" -#: forms.py:1201 forms.py:1398 +#: forms.py:1211 forms.py:1409 msgid "Indexed?" msgstr "" -#: forms.py:1207 forms.py:1272 models.py:619 +#: forms.py:1217 forms.py:1282 models.py:619 #: templates/ishtar/blocks/window_tables/administrativacts.html:10 msgid "Object" msgstr "" -#: forms.py:1244 views.py:403 +#: forms.py:1254 views.py:403 msgid "Administrative act search" msgstr "" -#: forms.py:1259 forms.py:1356 forms.py:1423 +#: forms.py:1269 forms.py:1367 forms.py:1434 msgid "You should select an administrative act." msgstr "" -#: forms.py:1275 models.py:616 +#: forms.py:1285 models.py:616 msgid "Signature date" msgstr "" -#: forms.py:1316 +#: forms.py:1327 #, python-format msgid "" "This index already exist for year: %(year)d - use a value bigger than " "%(last_val)d" msgstr "" -#: forms.py:1320 +#: forms.py:1331 msgid "Bad index" msgstr "" -#: forms.py:1333 +#: forms.py:1344 msgid "Would you like to delete this administrative act?" msgstr "" -#: forms.py:1338 +#: forms.py:1349 msgid "Template" msgstr "" -#: forms.py:1362 forms.py:1366 +#: forms.py:1373 forms.py:1377 msgid "This document is not intended for this type of act." msgstr "" -#: forms.py:1384 +#: forms.py:1395 msgid "Doc generation" msgstr "" -#: forms.py:1386 +#: forms.py:1397 msgid "Generate the associated doc?" msgstr "" -#: forms.py:1407 ishtar_menu.py:121 views.py:456 +#: forms.py:1418 ishtar_menu.py:121 views.py:456 msgctxt "admin act register" msgid "Register" msgstr "" diff --git a/archaeological_operations/utils.py b/archaeological_operations/utils.py index 53bfedc62..a84ff44ae 100644 --- a/archaeological_operations/utils.py +++ b/archaeological_operations/utils.py @@ -289,7 +289,7 @@ def parse_title(value): return value.title() -def parse_name_surname(value): +def parse_name_surname(value, owner): value = parse_string(value) items = value.split(' ') name = items[0] @@ -305,7 +305,7 @@ def parse_name_surname(value): if q.count(): return q.all()[0] else: - defaults = {'history_modifier': get_default_user(), + defaults = {'history_modifier': owner, 'title': ''} defaults.update(values) p = Person.objects.create(**defaults) |
