diff options
| -rw-r--r-- | CHANGES.md | 7 | ||||
| -rw-r--r-- | archaeological_operations/forms.py | 18 | ||||
| -rw-r--r-- | archaeological_operations/models.py | 13 | ||||
| -rw-r--r-- | archaeological_operations/urls.py | 10 | ||||
| -rw-r--r-- | archaeological_operations/views.py | 5 | ||||
| -rw-r--r-- | ishtar_common/forms.py | 1 | 
6 files changed, 49 insertions, 5 deletions
| diff --git a/CHANGES.md b/CHANGES.md index fc3574f57..458fb087b 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,9 +6,10 @@ v3.0.4 - 2020-XX-XX  ### Features ###  - Quick actions - sheets: add duplicate for site, operation, document and context record  - Quick actions - tables: -  - find: edit - add appraisal date and treatment emergency fields -  - person: edit - add organization field -  - operation: edit - add operator field +  - find: bulk update - appraisal date and treatment emergency fields +  - person: bulk update - organization field +  - operation: bulk update - operator field +  - site: add bulk update form (towns field)  v3.0.3 - 2020-02-24  ------------------- diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py index f8cc19165..9a3335df5 100644 --- a/archaeological_operations/forms.py +++ b/archaeological_operations/forms.py @@ -1983,3 +1983,21 @@ class QAArchaeologicalSiteDuplicateForm(IshtarForm):          for k in ("name", "reference"):              data[k] = self.cleaned_data.get("qa_" + k, None)          return self.site.duplicate(self.user, data=data) + + +class QAArchaeologicalSiteFormMulti(QAForm): +    form_admin_name = _("Archaeological files - Quick action - Modify") +    form_slug = "archaeological_site-quickaction-modify" +    associated_models = { +        'qa_towns': Town, +    } + +    MULTI = True +    qa_towns = get_town_field(required=False) + +    def _get_qa_towns(self, value): +        try: +            value = Town.objects.get(pk=value).cached_label +        except Town.DoesNotExist: +            return "" +        return value diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py index 54a44999c..8dd6568b8 100644 --- a/archaeological_operations/models.py +++ b/archaeological_operations/models.py @@ -278,11 +278,19 @@ class ArchaeologicalSite(DocumentItem, BaseHistorizedItem, QRCodeItem,      DOWN_MODEL_UPDATE = ["context_records"]      QA_LOCK = QuickAction( -        url="operation-qa-lock", icon_class="fa fa-lock", +        url="site-qa-lock", icon_class="fa fa-lock",          text=_(u"Lock/Unlock"), target="many", -        rights=['change_operation', 'change_own_operation'] +        rights=['change_archaeologicalsite', +                'change_own_archaeologicalsite'] +    ) +    QA_EDIT = QuickAction( +        url="site-qa-bulk-update", icon_class="fa fa-pencil", +        text=_(u"Bulk update"), target="many", +        rights=['change_archaeologicalsite', +                'change_own_archaeologicalsite']      )      QUICK_ACTIONS = [ +        QA_EDIT,          QA_LOCK,          QuickAction(              url="site-qa-duplicate", icon_class="fa fa-clone", @@ -946,6 +954,7 @@ class Operation(ClosedItem, DocumentItem, BaseHistorizedItem, QRCodeItem,      QA_EDIT = QuickAction(          url="operation-qa-bulk-update", icon_class="fa fa-pencil",          text=_(u"Bulk update"), target="many", +        rights=['change_operation', 'change_own_operation']      )      QA_LOCK = QuickAction(          url="operation-qa-lock", icon_class="fa fa-lock", diff --git a/archaeological_operations/urls.py b/archaeological_operations/urls.py index a1e658c04..77791058a 100644 --- a/archaeological_operations/urls.py +++ b/archaeological_operations/urls.py @@ -202,4 +202,14 @@ urlpatterns = [      url(r'^site-qa-lock/(?P<pks>[0-9-]+)?/$',          views.QASiteLockView.as_view(), name='site-qa-lock',          kwargs={"model": models.ArchaeologicalSite}), +    url(r'^site-qa-bulk-update/(?P<pks>[0-9-]+)?/$', +        check_rights(['change_archaeologicalsite', +                      'change_own_archaeologicalsite'])( +            views.QAArchaeologicalSiteForm.as_view()), +        name='site-qa-bulk-update'), +    url(r'^site-qa-bulk-update/(?P<pks>[0-9-]+)?/confirm/$', +        check_rights(['change_archaeologicalsite', +                      'change_own_archaeologicalsite'])( +            views.QAArchaeologicalSiteForm.as_view()), +        name='site-qa-bulk-update-confirm', kwargs={"confirm": True}),  ] diff --git a/archaeological_operations/views.py b/archaeological_operations/views.py index 657ee7b1e..ecacdb560 100644 --- a/archaeological_operations/views.py +++ b/archaeological_operations/views.py @@ -639,3 +639,8 @@ class QAArchaeologicalSiteDuplicateFormView(QAItemForm):                       self).get_context_data(**kwargs)          data['action_name'] = _("Duplicate")          return data + + +class QAArchaeologicalSiteForm(QAItemEditForm): +    model = models.ArchaeologicalSite +    form_class = forms.QAArchaeologicalSiteFormMulti diff --git a/ishtar_common/forms.py b/ishtar_common/forms.py index 16edbdcd4..17ada982f 100644 --- a/ishtar_common/forms.py +++ b/ishtar_common/forms.py @@ -1035,6 +1035,7 @@ class QAForm(CustomForm, ManageOldType):                  else:                      self._set_value(item, base_key)              item.history_modifier = user +            item._cached_label_checked = False              item.save() | 
