Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
85ae443d
authored
Feb 18, 2014
by
Oláh István Gergely
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
views: add remove_trait to NodeDetailView
parent
3706a11a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
0 deletions
+18
-0
circle/dashboard/views.py
+18
-0
No files found.
circle/dashboard/views.py
View file @
85ae443d
...
@@ -457,6 +457,8 @@ class NodeDetailView(LoginRequiredMixin, SuperuserRequiredMixin, DetailView):
...
@@ -457,6 +457,8 @@ class NodeDetailView(LoginRequiredMixin, SuperuserRequiredMixin, DetailView):
return
self
.
__set_status
(
request
)
return
self
.
__set_status
(
request
)
if
request
.
POST
.
get
(
'new_trait'
):
if
request
.
POST
.
get
(
'new_trait'
):
return
self
.
__add_trait
(
request
)
return
self
.
__add_trait
(
request
)
if
request
.
POST
.
get
(
'to_remove'
):
return
self
.
__remove_trait
(
request
)
def
__set_name
(
self
,
request
):
def
__set_name
(
self
,
request
):
self
.
object
=
self
.
get_object
()
self
.
object
=
self
.
get_object
()
...
@@ -525,6 +527,22 @@ class NodeDetailView(LoginRequiredMixin, SuperuserRequiredMixin, DetailView):
...
@@ -525,6 +527,22 @@ class NodeDetailView(LoginRequiredMixin, SuperuserRequiredMixin, DetailView):
return
redirect
(
reverse_lazy
(
"dashboard.views.node-detail"
,
return
redirect
(
reverse_lazy
(
"dashboard.views.node-detail"
,
kwargs
=
{
'pk'
:
self
.
object
.
pk
}))
kwargs
=
{
'pk'
:
self
.
object
.
pk
}))
def
__remove_trait
(
self
,
request
):
try
:
to_remove
=
request
.
POST
.
get
(
'to_remove'
)
self
.
object
=
self
.
get_object
()
self
.
object
.
tags
.
remove
(
to_remove
)
message
=
u"Success"
except
:
# note this won't really happen
message
=
u"Not success"
if
request
.
is_ajax
():
return
HttpResponse
(
json
.
dumps
({
'message'
:
message
}),
content_type
=
"application=json"
)
class
GroupDetailView
(
CheckedDetailView
):
class
GroupDetailView
(
CheckedDetailView
):
template_name
=
"dashboard/group-detail.html"
template_name
=
"dashboard/group-detail.html"
...
...
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