Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
bee83c92
authored
Feb 20, 2014
by
Oláh István Gergely
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: separate user remove and acl member remove views
parent
8763f0bd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
3 deletions
+16
-3
circle/dashboard/views.py
+16
-3
No files found.
circle/dashboard/views.py
View file @
bee83c92
...
@@ -986,7 +986,7 @@ class GroupUserDelete(LoginRequiredMixin, SuperuserRequiredMixin, DeleteView):
...
@@ -986,7 +986,7 @@ class GroupUserDelete(LoginRequiredMixin, SuperuserRequiredMixin, DeleteView):
return
reverse_lazy
(
'dashboard.index'
)
return
reverse_lazy
(
'dashboard.index'
)
class
Group
Acl
RemoveView
(
LoginRequiredMixin
,
DeleteView
):
class
Group
User
RemoveView
(
LoginRequiredMixin
,
DeleteView
):
model
=
Group
model
=
Group
slug_field
=
'pk'
slug_field
=
'pk'
slug_url_kwarg
=
'group_pk'
slug_url_kwarg
=
'group_pk'
...
@@ -1005,13 +1005,16 @@ class GroupAclRemoveView(LoginRequiredMixin, DeleteView):
...
@@ -1005,13 +1005,16 @@ class GroupAclRemoveView(LoginRequiredMixin, DeleteView):
return
[
'dashboard/confirm/base-remove.html'
]
return
[
'dashboard/confirm/base-remove.html'
]
def
remove_user
(
self
,
userpk
):
def
remove_user
(
self
,
userpk
):
container
=
self
.
get_object
()
.
profile
container
=
self
.
get_object
()
container
.
set_level
(
User
.
objects
.
get
(
pk
=
userpk
),
None
)
container
.
set_level
(
User
.
objects
.
get
(
pk
=
userpk
),
None
)
def
get_success_message
(
self
):
return
_
(
"Member successfully removed from group!"
)
def
delete
(
self
,
request
,
*
args
,
**
kwargs
):
def
delete
(
self
,
request
,
*
args
,
**
kwargs
):
self
.
remove_user
(
kwargs
[
"user_pk"
])
self
.
remove_user
(
kwargs
[
"user_pk"
])
success_url
=
self
.
get_success_url
()
success_url
=
self
.
get_success_url
()
success_message
=
_
(
"Acl member successfully removed from group!"
)
success_message
=
self
.
get_success_message
(
)
if
request
.
is_ajax
():
if
request
.
is_ajax
():
return
HttpResponse
(
return
HttpResponse
(
...
@@ -1023,6 +1026,16 @@ class GroupAclRemoveView(LoginRequiredMixin, DeleteView):
...
@@ -1023,6 +1026,16 @@ class GroupAclRemoveView(LoginRequiredMixin, DeleteView):
return
HttpResponseRedirect
(
success_url
)
return
HttpResponseRedirect
(
success_url
)
class
GroupAclRemoveView
(
GroupUserRemoveView
):
def
remove_user
(
self
,
userpk
):
container
=
self
.
get_object
()
.
profile
container
.
set_level
(
User
.
objects
.
get
(
pk
=
userpk
),
None
)
def
get_success_message
(
self
):
return
_
(
"Acl member successfully removed from group!"
)
class
GroupDelete
(
LoginRequiredMixin
,
SuperuserRequiredMixin
,
DeleteView
):
class
GroupDelete
(
LoginRequiredMixin
,
SuperuserRequiredMixin
,
DeleteView
):
"""This stuff deletes the group.
"""This stuff deletes the group.
...
...
Write
Preview
Markdown
is supported
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