diff options
Diffstat (limited to 'ishtar_common')
| -rw-r--r-- | ishtar_common/forms_common.py | 26 | ||||
| -rw-r--r-- | ishtar_common/models.py | 9 | ||||
| -rw-r--r-- | ishtar_common/urls.py | 9 | ||||
| -rw-r--r-- | ishtar_common/views.py | 5 | 
4 files changed, 45 insertions, 4 deletions
| diff --git a/ishtar_common/forms_common.py b/ishtar_common/forms_common.py index 5eaa6c435..67e29289a 100644 --- a/ishtar_common/forms_common.py +++ b/ishtar_common/forms_common.py @@ -376,7 +376,7 @@ class OrganizationSelect(CustomForm, TableSelect):              models.OrganizationType.get_types() -class OrganizationFormSelection(forms.Form): +class OrganizationFormSelection(CustomFormSearch):      SEARCH_AND_SELECT = True      form_label = _(u"Organization search")      associated_models = {'pk': models.Organization} @@ -404,6 +404,27 @@ class OrganizationFormMultiSelection(MultiSearchForm):          validators=[models.valid_ids(models.Organization)]) +class QAOrganizationFormMulti(QAForm): +    form_admin_name = _(u"Organization - Quick action - Modify") +    form_slug = "organization-quickaction-modify" +    base_models = ['qa_organization_type'] +    associated_models = { +        'qa_organization_type': models.OrganizationType, +    } + +    MULTI = True +    REPLACE_FIELDS = [ +        'qa_organization_type', +    ] +    qa_organization_type = forms.ChoiceField( +        label=_(u"Organization type"), required=False +    ) + +    TYPES = [ +        FieldType('qa_organization_type', models.OrganizationType), +    ] + +  class ManualMerge(object):      def clean_to_merge(self):          value = self.cleaned_data.get('to_merge', None) or [] @@ -1421,14 +1442,13 @@ class QADocumentFormMulti(QAForm):      )      qa_authors = widgets.ModelJQueryAutocompleteField(          model=models.Author, label=_(u"Author"), new=True, -        long_widget=True, required=False) +        required=False)      TYPES = [          FieldType('qa_source_type', models.SourceType),      ]      def _get_qa_authors(self, value): -        print(value)          try:              value = models.Author.objects.get(pk=value).cached_label          except models.Author.DoesNotExist: diff --git a/ishtar_common/models.py b/ishtar_common/models.py index c82837483..66de551da 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -4015,7 +4015,7 @@ organization_type_pk_lazy = lazy(OrganizationType.get_or_create_pk, str)  organization_type_pks_lazy = lazy(OrganizationType.get_or_create_pks, str) -class Organization(Address, Merge, OwnPerms, ValueGetter): +class Organization(Address, Merge, OwnPerms, ValueGetter, MainItem):      TABLE_COLS = ('name', 'organization_type', 'town')      SLUG = "organization"      SHOW_URL = 'show-organization' @@ -4037,6 +4037,13 @@ class Organization(Address, Merge, OwnPerms, ValueGetter):              'organization_type__label__iexact'          ),      } +    QA_EDIT = QuickAction( +        url="organization-qa-bulk-update", icon_class="fa fa-pencil", +        text=_(u"Bulk update"), target="many", +        rights=['change_organization']) +    QUICK_ACTIONS = [ +        QA_EDIT +    ]      objects = UUIDModelManager() diff --git a/ishtar_common/urls.py b/ishtar_common/urls.py index 07e084e40..664a6b391 100644 --- a/ishtar_common/urls.py +++ b/ishtar_common/urls.py @@ -112,6 +112,15 @@ urlpatterns = [          check_rights(['change_organization', 'change_own_organization'])(              views.OrganizationPersonEdit.as_view()),          name='organization_person_edit'), +    url(r'^organization-qa-bulk-update/(?P<pks>[0-9-]+)?/$', +        check_rights(['change_organization', 'change_own_organization'])( +            views.QAOrganizationForm.as_view()), +        name='organization-qa-bulk-update'), +    url(r'^organization-qa-bulk-update/(?P<pks>[0-9-]+)?/confirm/$', +        check_rights(['change_organization', 'change_own_organization'])( +            views.QAOrganizationForm.as_view()), +        name='organization-qa-bulk-update-confirm', kwargs={"confirm": True}), +      url(r'get-ishtaruser/(?P<type>.+)?$',          views.get_ishtaruser,          name='get-ishtaruser'), diff --git a/ishtar_common/views.py b/ishtar_common/views.py index 784a8bd0f..f1f7f2a82 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -2319,6 +2319,11 @@ class QABaseLockView(QAItemForm):          return HttpResponseRedirect(reverse("success")) +class QAOrganizationForm(QAItemEditForm): +    model = models.Organization +    form_class = forms.QAOrganizationFormMulti + +  class QAPersonForm(QAItemEditForm):      model = models.Person      form_class = forms.QAPersonFormMulti | 
