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
577130c4
authored
May 12, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: change exclamation points
parent
d229de28
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
38 deletions
+38
-38
circle/dashboard/views.py
+38
-38
No files found.
circle/dashboard/views.py
View file @
577130c4
...
@@ -273,9 +273,9 @@ class VmDetailView(CheckedDetailView):
...
@@ -273,9 +273,9 @@ class VmDetailView(CheckedDetailView):
raise
PermissionDenied
()
raise
PermissionDenied
()
self
.
object
.
change_password
(
user
=
request
.
user
)
self
.
object
.
change_password
(
user
=
request
.
user
)
messages
.
success
(
request
,
_
(
"Password changed
!
"
))
messages
.
success
(
request
,
_
(
"Password changed
.
"
))
if
request
.
is_ajax
():
if
request
.
is_ajax
():
return
HttpResponse
(
"Success
!
"
)
return
HttpResponse
(
"Success
.
"
)
else
:
else
:
return
redirect
(
reverse_lazy
(
"dashboard.views.detail"
,
return
redirect
(
reverse_lazy
(
"dashboard.views.detail"
,
kwargs
=
{
'pk'
:
self
.
object
.
pk
}))
kwargs
=
{
'pk'
:
self
.
object
.
pk
}))
...
@@ -295,7 +295,7 @@ class VmDetailView(CheckedDetailView):
...
@@ -295,7 +295,7 @@ class VmDetailView(CheckedDetailView):
}
}
Instance
.
objects
.
filter
(
pk
=
self
.
object
.
pk
)
.
update
(
**
resources
)
Instance
.
objects
.
filter
(
pk
=
self
.
object
.
pk
)
.
update
(
**
resources
)
success_message
=
_
(
"Resources successfully updated
!
"
)
success_message
=
_
(
"Resources successfully updated
.
"
)
if
request
.
is_ajax
():
if
request
.
is_ajax
():
response
=
{
'message'
:
success_message
}
response
=
{
'message'
:
success_message
}
return
HttpResponse
(
return
HttpResponse
(
...
@@ -315,7 +315,7 @@ class VmDetailView(CheckedDetailView):
...
@@ -315,7 +315,7 @@ class VmDetailView(CheckedDetailView):
Instance
.
objects
.
filter
(
pk
=
self
.
object
.
pk
)
.
update
(
Instance
.
objects
.
filter
(
pk
=
self
.
object
.
pk
)
.
update
(
**
{
'name'
:
new_name
})
**
{
'name'
:
new_name
})
success_message
=
_
(
"VM successfully renamed
!
"
)
success_message
=
_
(
"VM successfully renamed
.
"
)
if
request
.
is_ajax
():
if
request
.
is_ajax
():
response
=
{
response
=
{
'message'
:
success_message
,
'message'
:
success_message
,
...
@@ -339,7 +339,7 @@ class VmDetailView(CheckedDetailView):
...
@@ -339,7 +339,7 @@ class VmDetailView(CheckedDetailView):
Instance
.
objects
.
filter
(
pk
=
self
.
object
.
pk
)
.
update
(
Instance
.
objects
.
filter
(
pk
=
self
.
object
.
pk
)
.
update
(
**
{
'description'
:
new_description
})
**
{
'description'
:
new_description
})
success_message
=
_
(
"VM description successfully updated
!
"
)
success_message
=
_
(
"VM description successfully updated
.
"
)
if
request
.
is_ajax
():
if
request
.
is_ajax
():
response
=
{
response
=
{
'message'
:
success_message
,
'message'
:
success_message
,
...
@@ -360,9 +360,9 @@ class VmDetailView(CheckedDetailView):
...
@@ -360,9 +360,9 @@ class VmDetailView(CheckedDetailView):
raise
PermissionDenied
()
raise
PermissionDenied
()
if
len
(
new_tag
)
<
1
:
if
len
(
new_tag
)
<
1
:
message
=
u"Please input something
!
"
message
=
u"Please input something
.
"
elif
len
(
new_tag
)
>
20
:
elif
len
(
new_tag
)
>
20
:
message
=
u"Tag name is too long
!
"
message
=
u"Tag name is too long
.
"
else
:
else
:
self
.
object
.
tags
.
add
(
new_tag
)
self
.
object
.
tags
.
add
(
new_tag
)
...
@@ -416,7 +416,7 @@ class VmDetailView(CheckedDetailView):
...
@@ -416,7 +416,7 @@ class VmDetailView(CheckedDetailView):
unicode
(
request
.
user
),
object
)
unicode
(
request
.
user
),
object
)
raise
PermissionDenied
()
raise
PermissionDenied
()
except
ValueError
:
except
ValueError
:
error
=
_
(
"There is a problem with your input
!
"
)
error
=
_
(
"There is a problem with your input
.
"
)
except
Exception
as
e
:
except
Exception
as
e
:
error
=
_
(
"Unknown error."
)
error
=
_
(
"Unknown error."
)
logger
.
error
(
e
)
logger
.
error
(
e
)
...
@@ -439,7 +439,7 @@ class VmDetailView(CheckedDetailView):
...
@@ -439,7 +439,7 @@ class VmDetailView(CheckedDetailView):
raise
PermissionDenied
()
raise
PermissionDenied
()
try
:
try
:
self
.
object
.
add_interface
(
vlan
=
vlan
,
user
=
request
.
user
)
self
.
object
.
add_interface
(
vlan
=
vlan
,
user
=
request
.
user
)
messages
.
success
(
request
,
_
(
"Successfully added new interface
!
"
))
messages
.
success
(
request
,
_
(
"Successfully added new interface
.
"
))
except
Exception
,
e
:
except
Exception
,
e
:
error
=
u' '
.
join
(
e
.
messages
)
error
=
u' '
.
join
(
e
.
messages
)
messages
.
error
(
request
,
error
)
messages
.
error
(
request
,
error
)
...
@@ -640,7 +640,7 @@ class NodeDetailView(LoginRequiredMixin, SuperuserRequiredMixin, DetailView):
...
@@ -640,7 +640,7 @@ class NodeDetailView(LoginRequiredMixin, SuperuserRequiredMixin, DetailView):
Node
.
objects
.
filter
(
pk
=
self
.
object
.
pk
)
.
update
(
Node
.
objects
.
filter
(
pk
=
self
.
object
.
pk
)
.
update
(
**
{
'name'
:
new_name
})
**
{
'name'
:
new_name
})
success_message
=
_
(
"Node successfully renamed
!
"
)
success_message
=
_
(
"Node successfully renamed
.
"
)
if
request
.
is_ajax
():
if
request
.
is_ajax
():
response
=
{
response
=
{
'message'
:
success_message
,
'message'
:
success_message
,
...
@@ -733,7 +733,7 @@ class GroupDetailView(CheckedDetailView):
...
@@ -733,7 +733,7 @@ class GroupDetailView(CheckedDetailView):
Group
.
objects
.
filter
(
pk
=
self
.
object
.
pk
)
.
update
(
Group
.
objects
.
filter
(
pk
=
self
.
object
.
pk
)
.
update
(
**
{
'name'
:
new_name
})
**
{
'name'
:
new_name
})
success_message
=
_
(
"Group successfully renamed
!
"
)
success_message
=
_
(
"Group successfully renamed
.
"
)
if
request
.
is_ajax
():
if
request
.
is_ajax
():
response
=
{
response
=
{
'message'
:
success_message
,
'message'
:
success_message
,
...
@@ -789,7 +789,7 @@ class AclUpdateView(LoginRequiredMixin, View, SingleObjectMixin):
...
@@ -789,7 +789,7 @@ class AclUpdateView(LoginRequiredMixin, View, SingleObjectMixin):
logger
.
info
(
"Tried to remove owner from
%
s by
%
s."
,
logger
.
info
(
"Tried to remove owner from
%
s by
%
s."
,
unicode
(
instance
),
unicode
(
request
.
user
))
unicode
(
instance
),
unicode
(
request
.
user
))
msg
=
_
(
"The original owner cannot be removed, however "
msg
=
_
(
"The original owner cannot be removed, however "
"you can transfer ownership
!
"
)
"you can transfer ownership
.
"
)
messages
.
warning
(
request
,
msg
)
messages
.
warning
(
request
,
msg
)
continue
continue
instance
.
set_level
(
entity
,
None
)
instance
.
set_level
(
entity
,
None
)
...
@@ -898,7 +898,7 @@ class TemplateChoose(TemplateView):
...
@@ -898,7 +898,7 @@ class TemplateChoose(TemplateView):
if
template
==
"base_vm"
:
if
template
==
"base_vm"
:
return
redirect
(
reverse
(
"dashboard.views.template-create"
))
return
redirect
(
reverse
(
"dashboard.views.template-create"
))
elif
template
is
None
:
elif
template
is
None
:
messages
.
warning
(
request
,
_
(
"Select an option to proceed
!
"
))
messages
.
warning
(
request
,
_
(
"Select an option to proceed
.
"
))
return
redirect
(
reverse
(
"dashboard.views.template-choose"
))
return
redirect
(
reverse
(
"dashboard.views.template-choose"
))
else
:
else
:
template
=
get_object_or_404
(
InstanceTemplate
,
pk
=
template
)
template
=
get_object_or_404
(
InstanceTemplate
,
pk
=
template
)
...
@@ -981,7 +981,7 @@ class TemplateDetail(LoginRequiredMixin, SuccessMessageMixin, UpdateView):
...
@@ -981,7 +981,7 @@ class TemplateDetail(LoginRequiredMixin, SuccessMessageMixin, UpdateView):
model
=
InstanceTemplate
model
=
InstanceTemplate
template_name
=
"dashboard/template-edit.html"
template_name
=
"dashboard/template-edit.html"
form_class
=
TemplateForm
form_class
=
TemplateForm
success_message
=
_
(
"Successfully modified template
!
"
)
success_message
=
_
(
"Successfully modified template
.
"
)
def
get
(
self
,
request
,
*
args
,
**
kwargs
):
def
get
(
self
,
request
,
*
args
,
**
kwargs
):
template
=
self
.
get_object
()
template
=
self
.
get_object
()
...
@@ -1083,7 +1083,7 @@ class TemplateDelete(LoginRequiredMixin, DeleteView):
...
@@ -1083,7 +1083,7 @@ class TemplateDelete(LoginRequiredMixin, DeleteView):
object
.
delete
()
object
.
delete
()
success_url
=
self
.
get_success_url
()
success_url
=
self
.
get_success_url
()
success_message
=
_
(
"Template successfully deleted
!
"
)
success_message
=
_
(
"Template successfully deleted
.
"
)
if
request
.
is_ajax
():
if
request
.
is_ajax
():
return
HttpResponse
(
return
HttpResponse
(
...
@@ -1219,7 +1219,7 @@ class GroupRemoveUserView(CheckedDetailView, DeleteView):
...
@@ -1219,7 +1219,7 @@ class GroupRemoveUserView(CheckedDetailView, DeleteView):
container
.
user_set
.
remove
(
User
.
objects
.
get
(
pk
=
pk
))
container
.
user_set
.
remove
(
User
.
objects
.
get
(
pk
=
pk
))
def
get_success_message
(
self
):
def
get_success_message
(
self
):
return
_
(
"Member successfully removed from group
!
"
)
return
_
(
"Member successfully removed from group
.
"
)
def
delete
(
self
,
request
,
*
args
,
**
kwargs
):
def
delete
(
self
,
request
,
*
args
,
**
kwargs
):
object
=
self
.
get_object
()
object
=
self
.
get_object
()
...
@@ -1245,7 +1245,7 @@ class GroupRemoveAclUserView(GroupRemoveUserView):
...
@@ -1245,7 +1245,7 @@ class GroupRemoveAclUserView(GroupRemoveUserView):
container
.
set_level
(
User
.
objects
.
get
(
pk
=
pk
),
None
)
container
.
set_level
(
User
.
objects
.
get
(
pk
=
pk
),
None
)
def
get_success_message
(
self
):
def
get_success_message
(
self
):
return
_
(
"Acl user successfully removed from group
!
"
)
return
_
(
"Acl user successfully removed from group
.
"
)
class
GroupRemoveAclGroupView
(
GroupRemoveUserView
):
class
GroupRemoveAclGroupView
(
GroupRemoveUserView
):
...
@@ -1263,7 +1263,7 @@ class GroupRemoveAclGroupView(GroupRemoveUserView):
...
@@ -1263,7 +1263,7 @@ class GroupRemoveAclGroupView(GroupRemoveUserView):
container
.
set_level
(
Group
.
objects
.
get
(
pk
=
pk
),
None
)
container
.
set_level
(
Group
.
objects
.
get
(
pk
=
pk
),
None
)
def
get_success_message
(
self
):
def
get_success_message
(
self
):
return
_
(
"Acl group successfully removed from group
!
"
)
return
_
(
"Acl group successfully removed from group
.
"
)
class
GroupDelete
(
CheckedDetailView
,
DeleteView
):
class
GroupDelete
(
CheckedDetailView
,
DeleteView
):
...
@@ -1290,7 +1290,7 @@ class GroupDelete(CheckedDetailView, DeleteView):
...
@@ -1290,7 +1290,7 @@ class GroupDelete(CheckedDetailView, DeleteView):
raise
PermissionDenied
()
raise
PermissionDenied
()
object
.
delete
()
object
.
delete
()
success_url
=
self
.
get_success_url
()
success_url
=
self
.
get_success_url
()
success_message
=
_
(
"Group successfully deleted
!
"
)
success_message
=
_
(
"Group successfully deleted
.
"
)
if
request
.
is_ajax
():
if
request
.
is_ajax
():
if
request
.
POST
.
get
(
'redirect'
)
.
lower
()
==
"true"
:
if
request
.
POST
.
get
(
'redirect'
)
.
lower
()
==
"true"
:
...
@@ -1410,11 +1410,11 @@ class VmCreate(LoginRequiredMixin, TemplateView):
...
@@ -1410,11 +1410,11 @@ class VmCreate(LoginRequiredMixin, TemplateView):
i
.
deploy
.
async
(
user
=
request
.
user
)
i
.
deploy
.
async
(
user
=
request
.
user
)
if
len
(
instances
)
>
1
:
if
len
(
instances
)
>
1
:
messages
.
success
(
request
,
_
(
"Successfully created
%
d VMs
!
"
%
messages
.
success
(
request
,
_
(
"Successfully created
%
d VMs
.
"
%
len
(
instances
)))
len
(
instances
)))
path
=
reverse
(
"dashboard.index"
)
path
=
reverse
(
"dashboard.index"
)
else
:
else
:
messages
.
success
(
request
,
_
(
"VM successfully created
!
"
))
messages
.
success
(
request
,
_
(
"VM successfully created
.
"
))
path
=
instances
[
0
]
.
get_absolute_url
()
path
=
instances
[
0
]
.
get_absolute_url
()
if
request
.
is_ajax
():
if
request
.
is_ajax
():
...
@@ -1504,7 +1504,7 @@ class NodeCreate(LoginRequiredMixin, SuperuserRequiredMixin, TemplateView):
...
@@ -1504,7 +1504,7 @@ class NodeCreate(LoginRequiredMixin, SuperuserRequiredMixin, TemplateView):
savedform
.
save
()
savedform
.
save
()
nodemodel
=
formset
.
save
()
nodemodel
=
formset
.
save
()
messages
.
success
(
request
,
_
(
'Node successfully created
!
'
))
messages
.
success
(
request
,
_
(
'Node successfully created
.
'
))
path
=
nodemodel
[
0
]
.
get_absolute_url
()
path
=
nodemodel
[
0
]
.
get_absolute_url
()
if
request
.
is_ajax
():
if
request
.
is_ajax
():
return
HttpResponse
(
json
.
dumps
({
'redirect'
:
path
}),
return
HttpResponse
(
json
.
dumps
({
'redirect'
:
path
}),
...
@@ -1547,7 +1547,7 @@ class GroupCreate(LoginRequiredMixin, TemplateView):
...
@@ -1547,7 +1547,7 @@ class GroupCreate(LoginRequiredMixin, TemplateView):
form
.
cleaned_data
form
.
cleaned_data
savedform
=
form
.
save
()
savedform
=
form
.
save
()
savedform
.
profile
.
set_level
(
request
.
user
,
'owner'
)
savedform
.
profile
.
set_level
(
request
.
user
,
'owner'
)
messages
.
success
(
request
,
_
(
'Group successfully created
!
'
))
messages
.
success
(
request
,
_
(
'Group successfully created
.
'
))
if
request
.
is_ajax
():
if
request
.
is_ajax
():
return
HttpResponse
(
json
.
dumps
({
'redirect'
:
return
HttpResponse
(
json
.
dumps
({
'redirect'
:
savedform
.
profile
.
get_absolute_url
()}),
savedform
.
profile
.
get_absolute_url
()}),
...
@@ -1590,7 +1590,7 @@ class VmDelete(LoginRequiredMixin, DeleteView):
...
@@ -1590,7 +1590,7 @@ class VmDelete(LoginRequiredMixin, DeleteView):
object
.
destroy
.
async
(
user
=
request
.
user
)
object
.
destroy
.
async
(
user
=
request
.
user
)
success_url
=
self
.
get_success_url
()
success_url
=
self
.
get_success_url
()
success_message
=
_
(
"VM successfully deleted
!
"
)
success_message
=
_
(
"VM successfully deleted
.
"
)
if
request
.
is_ajax
():
if
request
.
is_ajax
():
if
request
.
POST
.
get
(
'redirect'
)
.
lower
()
==
"true"
:
if
request
.
POST
.
get
(
'redirect'
)
.
lower
()
==
"true"
:
...
@@ -1629,7 +1629,7 @@ class NodeDelete(LoginRequiredMixin, SuperuserRequiredMixin, DeleteView):
...
@@ -1629,7 +1629,7 @@ class NodeDelete(LoginRequiredMixin, SuperuserRequiredMixin, DeleteView):
object
.
delete
()
object
.
delete
()
success_url
=
self
.
get_success_url
()
success_url
=
self
.
get_success_url
()
success_message
=
_
(
"Node successfully deleted
!
"
)
success_message
=
_
(
"Node successfully deleted
.
"
)
if
request
.
is_ajax
():
if
request
.
is_ajax
():
if
request
.
POST
.
get
(
'redirect'
)
.
lower
()
==
"true"
:
if
request
.
POST
.
get
(
'redirect'
)
.
lower
()
==
"true"
:
...
@@ -1721,7 +1721,7 @@ class NodeStatus(LoginRequiredMixin, SuperuserRequiredMixin, DetailView):
...
@@ -1721,7 +1721,7 @@ class NodeStatus(LoginRequiredMixin, SuperuserRequiredMixin, DetailView):
self
.
object
.
enable
(
user
=
request
.
user
)
self
.
object
.
enable
(
user
=
request
.
user
)
else
:
else
:
self
.
object
.
disable
(
user
=
request
.
user
)
self
.
object
.
disable
(
user
=
request
.
user
)
success_message
=
_
(
"Node successfully changed status
!
"
)
success_message
=
_
(
"Node successfully changed status
.
"
)
if
request
.
is_ajax
():
if
request
.
is_ajax
():
response
=
{
response
=
{
...
@@ -1768,7 +1768,7 @@ class NodeFlushView(LoginRequiredMixin, SuperuserRequiredMixin, DetailView):
...
@@ -1768,7 +1768,7 @@ class NodeFlushView(LoginRequiredMixin, SuperuserRequiredMixin, DetailView):
def
__flush
(
self
,
request
):
def
__flush
(
self
,
request
):
self
.
object
=
self
.
get_object
()
self
.
object
=
self
.
get_object
()
self
.
object
.
flush
.
async
(
user
=
request
.
user
)
self
.
object
.
flush
.
async
(
user
=
request
.
user
)
success_message
=
_
(
"Node successfully flushed
!
"
)
success_message
=
_
(
"Node successfully flushed
.
"
)
messages
.
success
(
request
,
success_message
)
messages
.
success
(
request
,
success_message
)
return
redirect
(
self
.
get_success_url
())
return
redirect
(
self
.
get_success_url
())
...
@@ -1803,7 +1803,7 @@ class PortDelete(LoginRequiredMixin, DeleteView):
...
@@ -1803,7 +1803,7 @@ class PortDelete(LoginRequiredMixin, DeleteView):
super
(
PortDelete
,
self
)
.
delete
(
request
,
*
args
,
**
kwargs
)
super
(
PortDelete
,
self
)
.
delete
(
request
,
*
args
,
**
kwargs
)
success_url
=
self
.
get_success_url
()
success_url
=
self
.
get_success_url
()
success_message
=
_
(
"Port successfully removed
!
"
)
success_message
=
_
(
"Port successfully removed
.
"
)
if
request
.
is_ajax
():
if
request
.
is_ajax
():
return
HttpResponse
(
return
HttpResponse
(
...
@@ -1845,7 +1845,7 @@ class VmMassDelete(LoginRequiredMixin, View):
...
@@ -1845,7 +1845,7 @@ class VmMassDelete(LoginRequiredMixin, View):
logger
.
error
(
e
)
logger
.
error
(
e
)
success_message
=
_
(
"Mass delete complete, the following VMs were "
success_message
=
_
(
"Mass delete complete, the following VMs were "
"deleted:
%
s
!
"
)
%
u', '
.
join
(
names
)
"deleted:
%
s
.
"
)
%
u', '
.
join
(
names
)
# we can get this only via AJAX ...
# we can get this only via AJAX ...
if
request
.
is_ajax
():
if
request
.
is_ajax
():
...
@@ -1864,7 +1864,7 @@ class LeaseCreate(LoginRequiredMixin, SuperuserRequiredMixin,
...
@@ -1864,7 +1864,7 @@ class LeaseCreate(LoginRequiredMixin, SuperuserRequiredMixin,
model
=
Lease
model
=
Lease
form_class
=
LeaseForm
form_class
=
LeaseForm
template_name
=
"dashboard/lease-create.html"
template_name
=
"dashboard/lease-create.html"
success_message
=
_
(
"Successfully created a new lease
!
"
)
success_message
=
_
(
"Successfully created a new lease
.
"
)
def
get_success_url
(
self
):
def
get_success_url
(
self
):
return
reverse_lazy
(
"dashboard.views.template-list"
)
return
reverse_lazy
(
"dashboard.views.template-list"
)
...
@@ -1875,7 +1875,7 @@ class LeaseDetail(LoginRequiredMixin, SuperuserRequiredMixin,
...
@@ -1875,7 +1875,7 @@ class LeaseDetail(LoginRequiredMixin, SuperuserRequiredMixin,
model
=
Lease
model
=
Lease
form_class
=
LeaseForm
form_class
=
LeaseForm
template_name
=
"dashboard/lease-edit.html"
template_name
=
"dashboard/lease-edit.html"
success_message
=
_
(
"Successfully modified lease
!
"
)
success_message
=
_
(
"Successfully modified lease
.
"
)
def
get_success_url
(
self
):
def
get_success_url
(
self
):
return
reverse_lazy
(
"dashboard.views.lease-detail"
,
kwargs
=
self
.
kwargs
)
return
reverse_lazy
(
"dashboard.views.lease-detail"
,
kwargs
=
self
.
kwargs
)
...
@@ -1915,7 +1915,7 @@ class LeaseDelete(LoginRequiredMixin, SuperuserRequiredMixin, DeleteView):
...
@@ -1915,7 +1915,7 @@ class LeaseDelete(LoginRequiredMixin, SuperuserRequiredMixin, DeleteView):
object
.
delete
()
object
.
delete
()
success_url
=
self
.
get_success_url
()
success_url
=
self
.
get_success_url
()
success_message
=
_
(
"Lease successfully deleted
!
"
)
success_message
=
_
(
"Lease successfully deleted
.
"
)
if
request
.
is_ajax
():
if
request
.
is_ajax
():
return
HttpResponse
(
return
HttpResponse
(
...
@@ -1968,10 +1968,10 @@ class FavouriteView(TemplateView):
...
@@ -1968,10 +1968,10 @@ class FavouriteView(TemplateView):
vm
=
Instance
.
objects
.
get
(
pk
=
self
.
request
.
POST
.
get
(
"vm"
))
vm
=
Instance
.
objects
.
get
(
pk
=
self
.
request
.
POST
.
get
(
"vm"
))
try
:
try
:
Favourite
.
objects
.
get
(
instance
=
vm
,
user
=
user
)
.
delete
()
Favourite
.
objects
.
get
(
instance
=
vm
,
user
=
user
)
.
delete
()
return
HttpResponse
(
"Deleted
!
"
)
return
HttpResponse
(
"Deleted
.
"
)
except
Favourite
.
DoesNotExist
:
except
Favourite
.
DoesNotExist
:
Favourite
(
instance
=
vm
,
user
=
user
)
.
save
()
Favourite
(
instance
=
vm
,
user
=
user
)
.
save
()
return
HttpResponse
(
"Added
!
"
)
return
HttpResponse
(
"Added
.
"
)
class
TransferOwnershipView
(
LoginRequiredMixin
,
DetailView
):
class
TransferOwnershipView
(
LoginRequiredMixin
,
DetailView
):
...
@@ -2397,9 +2397,9 @@ class DiskAddView(TemplateView):
...
@@ -2397,9 +2397,9 @@ class DiskAddView(TemplateView):
if
form
.
is_valid
():
if
form
.
is_valid
():
if
form
.
cleaned_data
.
get
(
"size"
):
if
form
.
cleaned_data
.
get
(
"size"
):
messages
.
success
(
self
.
request
,
_
(
"Disk successfully added
!
"
))
messages
.
success
(
self
.
request
,
_
(
"Disk successfully added
.
"
))
else
:
else
:
messages
.
success
(
self
.
request
,
_
(
"Disk download started
!
"
))
messages
.
success
(
self
.
request
,
_
(
"Disk download started
.
"
))
form
.
save
()
form
.
save
()
else
:
else
:
error
=
"<br /> "
.
join
([
"<strong>
%
s</strong>:
%
s"
%
error
=
"<br /> "
.
join
([
"<strong>
%
s</strong>:
%
s"
%
...
@@ -2513,7 +2513,7 @@ class DiskRemoveView(DeleteView):
...
@@ -2513,7 +2513,7 @@ class DiskRemoveView(DeleteView):
next_url
=
request
.
POST
.
get
(
"next"
)
next_url
=
request
.
POST
.
get
(
"next"
)
success_url
=
next_url
if
next_url
else
app
.
get_absolute_url
()
success_url
=
next_url
if
next_url
else
app
.
get_absolute_url
()
success_message
=
_
(
"Disk successfully removed
!
"
)
success_message
=
_
(
"Disk successfully removed
.
"
)
if
request
.
is_ajax
():
if
request
.
is_ajax
():
return
HttpResponse
(
return
HttpResponse
(
...
@@ -2578,7 +2578,7 @@ class InterfaceDeleteView(DeleteView):
...
@@ -2578,7 +2578,7 @@ class InterfaceDeleteView(DeleteView):
instance
.
remove_interface
(
interface
=
self
.
object
,
user
=
request
.
user
)
instance
.
remove_interface
(
interface
=
self
.
object
,
user
=
request
.
user
)
success_url
=
self
.
get_success_url
()
success_url
=
self
.
get_success_url
()
success_message
=
_
(
"Interface successfully deleted
!
"
)
success_message
=
_
(
"Interface successfully deleted
.
"
)
if
request
.
is_ajax
():
if
request
.
is_ajax
():
return
HttpResponse
(
return
HttpResponse
(
...
...
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