Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gyuricska Milán
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
7b7d32dd
authored
Nov 11, 2013
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: add success messages to view
parent
c5be75b6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
3 deletions
+9
-3
circle/dashboard/views.py
+9
-3
No files found.
circle/dashboard/views.py
View file @
7b7d32dd
...
@@ -10,9 +10,10 @@ from django.core import signing
...
@@ -10,9 +10,10 @@ from django.core import signing
from
django.core.urlresolvers
import
reverse
,
reverse_lazy
from
django.core.urlresolvers
import
reverse
,
reverse_lazy
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
django.shortcuts
import
redirect
from
django.shortcuts
import
redirect
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.views.generic.detail
import
SingleObjectMixin
from
django.views.generic.detail
import
SingleObjectMixin
from
django.views.generic
import
TemplateView
,
DetailView
,
View
from
django.views.generic
import
TemplateView
,
DetailView
,
View
from
django.contrib
import
messages
from
django.utils.translation
import
ugettext
as
_
from
django_tables2
import
SingleTableView
from
django_tables2
import
SingleTableView
...
@@ -223,6 +224,7 @@ class VmCreate(TemplateView):
...
@@ -223,6 +224,7 @@ class VmCreate(TemplateView):
inst
.
deploy_async
()
inst
.
deploy_async
()
resp
[
'pk'
]
=
inst
.
pk
resp
[
'pk'
]
=
inst
.
pk
messages
.
success
(
request
,
_
(
'VM successfully created!'
))
except
InstanceTemplate
.
DoesNotExist
:
except
InstanceTemplate
.
DoesNotExist
:
resp
[
'error'
]
=
True
resp
[
'error'
]
=
True
except
:
except
:
...
@@ -240,11 +242,15 @@ def delete_vm(request, **kwargs):
...
@@ -240,11 +242,15 @@ def delete_vm(request, **kwargs):
vm_pk
=
kwargs
[
'pk'
]
vm_pk
=
kwargs
[
'pk'
]
vm
=
Instance
.
objects
.
get
(
pk
=
vm_pk
)
vm
=
Instance
.
objects
.
get
(
pk
=
vm_pk
)
print
vm
vm
.
destroy_async
()
vm
.
destroy_async
()
success_message
=
_
(
"VM successfully deleted!"
)
if
request
.
is_ajax
():
if
request
.
is_ajax
():
return
HttpResponse
(
"ok"
)
return
HttpResponse
(
json
.
dumps
({
'message'
:
success_message
}),
content_type
=
"application/json"
,
)
else
:
else
:
messages
.
success
(
request
,
success_message
)
next
=
request
.
GET
.
get
(
'next'
)
next
=
request
.
GET
.
get
(
'next'
)
return
redirect
(
next
if
next
else
reverse_lazy
(
'dashboard.index'
))
return
redirect
(
next
if
next
else
reverse_lazy
(
'dashboard.index'
))
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