Commit 5a305354 authored by Skia's avatar Skia

Add recursive option to file props form

parent 9efd85d9
Pipeline #715 passed with stage
in 2 minutes and 47 seconds
......@@ -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 ""})
......
......@@ -273,3 +273,4 @@ class AlbumEditView(CanEditMixin, UpdateView):
if form.cleaned_data['recursive']:
self.object.apply_rights_recursively(True)
return ret
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment