Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
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
2fd40158
authored
Sep 22, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: fix redirects
parent
9c93356a
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
13 deletions
+17
-13
circle/dashboard/views/template.py
+5
-4
circle/dashboard/views/util.py
+3
-2
circle/dashboard/views/vm.py
+9
-7
No files found.
circle/dashboard/views/template.py
View file @
2fd40158
...
...
@@ -24,7 +24,7 @@ from django.contrib.auth.models import User
from
django.contrib.messages.views
import
SuccessMessageMixin
from
django.core.urlresolvers
import
reverse
,
reverse_lazy
from
django.core.exceptions
import
PermissionDenied
,
SuspiciousOperation
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
,
HttpResponseRedirect
from
django.shortcuts
import
redirect
,
get_object_or_404
from
django.utils.translation
import
ugettext
as
_
from
django.views.generic
import
(
...
...
@@ -145,7 +145,8 @@ class TemplateCreate(SuccessMessageMixin, CreateView):
networks
=
networks
,
tags
=
tags
,
req_traits
=
req_traits
)
return
redirect
(
"
%
s#resources"
%
inst
.
get_absolute_url
())
return
HttpResponseRedirect
(
"
%
s#resources"
%
inst
.
get_absolute_url
())
def
__create_networks
(
self
,
vlans
,
user
):
networks
=
[]
...
...
@@ -255,7 +256,7 @@ class TemplateDelete(LoginRequiredMixin, DeleteView):
)
else
:
messages
.
success
(
request
,
success_message
)
return
r
edirect
(
success_url
)
return
HttpResponseR
edirect
(
success_url
)
class
TemplateDetail
(
LoginRequiredMixin
,
SuccessMessageMixin
,
UpdateView
):
...
...
@@ -394,4 +395,4 @@ class LeaseDelete(LoginRequiredMixin, SuperuserRequiredMixin, DeleteView):
)
else
:
messages
.
success
(
request
,
success_message
)
return
r
edirect
(
success_url
)
return
HttpResponseR
edirect
(
success_url
)
circle/dashboard/views/util.py
View file @
2fd40158
...
...
@@ -31,7 +31,7 @@ from django.core.urlresolvers import reverse
from
django.contrib
import
messages
from
django.contrib.auth.views
import
redirect_to_login
from
django.db.models
import
Q
from
django.http
import
HttpResponse
,
Http404
from
django.http
import
HttpResponse
,
Http404
,
HttpResponseRedirect
from
django.shortcuts
import
redirect
from
django.utils.translation
import
ugettext
as
_
from
django.views.generic
import
DetailView
,
View
...
...
@@ -299,7 +299,8 @@ class OperationView(RedirectToLoginMixin, DetailView):
return
HttpResponse
(
json
.
dumps
(
data
),
content_type
=
"application/json"
)
else
:
return
redirect
(
"
%
s#activity"
%
self
.
object
.
get_absolute_url
())
return
HttpResponseRedirect
(
"
%
s#activity"
%
self
.
object
.
get_absolute_url
())
@classmethod
def
factory
(
cls
,
op
,
icon
=
'cog'
,
effect
=
'info'
,
extra_bases
=
(),
**
kwargs
):
...
...
circle/dashboard/views/vm.py
View file @
2fd40158
...
...
@@ -27,7 +27,7 @@ from django.contrib.auth.models import User
from
django.core
import
signing
from
django.core.exceptions
import
PermissionDenied
,
SuspiciousOperation
from
django.core.urlresolvers
import
reverse
,
reverse_lazy
from
django.http
import
HttpResponse
,
Http404
from
django.http
import
HttpResponse
,
Http404
,
HttpResponseRedirect
from
django.shortcuts
import
redirect
,
get_object_or_404
,
render
from
django.template
import
RequestContext
from
django.template.loader
import
render_to_string
...
...
@@ -302,7 +302,8 @@ class VmDetailView(CheckedDetailView):
if
not
activity
.
is_abortable_for
(
request
.
user
):
raise
PermissionDenied
()
activity
.
abort
()
return
redirect
(
"
%
s#activity"
%
self
.
object
.
get_absolute_url
())
return
HttpResponseRedirect
(
"
%
s#activity"
%
self
.
object
.
get_absolute_url
())
class
VmTraitsUpdate
(
SuperuserRequiredMixin
,
UpdateView
):
...
...
@@ -442,7 +443,8 @@ class VmResourcesChangeView(VmOperationView):
content_type
=
"application=json"
)
else
:
return
redirect
(
instance
.
get_absolute_url
()
+
"#resources"
)
return
HttpResponseRedirect
(
instance
.
get_absolute_url
()
+
"#resources"
)
else
:
extra
=
form
.
cleaned_data
extra
[
'max_ram_size'
]
=
extra
[
'ram_size'
]
...
...
@@ -946,7 +948,7 @@ class VmCreate(LoginRequiredMixin, TemplateView):
return
HttpResponse
(
json
.
dumps
({
'redirect'
:
path
}),
content_type
=
"application/json"
)
else
:
return
r
edirect
(
"
%
s#activity"
%
path
)
return
HttpResponseR
edirect
(
"
%
s#activity"
%
path
)
def
post
(
self
,
request
,
*
args
,
**
kwargs
):
user
=
request
.
user
...
...
@@ -1057,7 +1059,7 @@ class InterfaceDeleteView(DeleteView):
)
else
:
messages
.
success
(
request
,
success_message
)
return
r
edirect
(
"
%
s#network"
%
success_url
)
return
HttpResponseR
edirect
(
"
%
s#network"
%
success_url
)
def
get_success_url
(
self
):
redirect
=
self
.
request
.
POST
.
get
(
"next"
)
...
...
@@ -1124,7 +1126,7 @@ class DiskRemoveView(DeleteView):
)
else
:
messages
.
success
(
request
,
success_message
)
return
r
edirect
(
"
%
s#resources"
%
success_url
)
return
HttpResponseR
edirect
(
"
%
s#resources"
%
success_url
)
@require_GET
...
...
@@ -1181,7 +1183,7 @@ class PortDelete(LoginRequiredMixin, DeleteView):
)
else
:
messages
.
success
(
request
,
success_message
)
return
r
edirect
(
"
%
s#network"
%
success_url
)
return
HttpResponseR
edirect
(
"
%
s#network"
%
success_url
)
def
get_success_url
(
self
):
return
reverse_lazy
(
'dashboard.views.detail'
,
...
...
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