Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
AE UTBM
Sith
Commits
5a305354
Commit
5a305354
authored
Jan 12, 2017
by
Skia
🤘
Browse files
Add recursive option to file props form
parent
9efd85d9
Pipeline
#715
passed with stage
in 2 minutes and 47 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
core/views/files.py
View file @
5a305354
...
...
@@ -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
""
})
...
...
sas/views.py
View file @
5a305354
...
...
@@ -273,3 +273,4 @@ class AlbumEditView(CanEditMixin, UpdateView):
if
form
.
cleaned_data
[
'recursive'
]:
self
.
object
.
apply_rights_recursively
(
True
)
return
ret
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment