diff --git a/core/views/files.py b/core/views/files.py index bd1a3c58..1885561b 100644 --- a/core/views/files.py +++ b/core/views/files.py @@ -120,7 +120,7 @@ class FileEditPropForm(forms.ModelForm): parent = make_ajax_field(SithFile, 'parent', 'files', help_text="") edit_groups = make_ajax_field(SithFile, 'edit_groups', 'groups', help_text="") view_groups = make_ajax_field(SithFile, 'view_groups', 'groups', help_text="") - + recursive = forms.BooleanField(label=_("Apply rights recursively"), required=False) class FileEditPropView(CanEditPropMixin, UpdateView): model = SithFile @@ -134,6 +134,12 @@ class FileEditPropView(CanEditPropMixin, UpdateView): form.fields['parent'].queryset = SithFile.objects.filter(is_folder=True) return form + def form_valid(self, form): + ret = super(FileEditPropView, self).form_valid(form) + if form.cleaned_data['recursive']: + self.object.apply_rights_recursively() + return ret + def get_success_url(self): return reverse('core:file_detail', kwargs={'file_id': self.object.id, 'popup': self.kwargs['popup'] or ""}) diff --git a/sas/views.py b/sas/views.py index d6525cab..5f510b3a 100644 --- a/sas/views.py +++ b/sas/views.py @@ -273,3 +273,4 @@ class AlbumEditView(CanEditMixin, UpdateView): if form.cleaned_data['recursive']: self.object.apply_rights_recursively(True) return ret +