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
0edc8ff2
authored
Mar 04, 2014
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: pass the user to create empty/url disk
parent
70b50134
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
2 deletions
+6
-2
circle/dashboard/forms.py
+3
-2
circle/dashboard/views.py
+3
-0
No files found.
circle/dashboard/forms.py
View file @
0edc8ff2
...
...
@@ -734,6 +734,7 @@ class DiskAddForm(forms.Form):
def
__init__
(
self
,
*
args
,
**
kwargs
):
self
.
is_template
=
kwargs
.
pop
(
"is_template"
)
self
.
object_pk
=
kwargs
.
pop
(
"object_pk"
)
self
.
user
=
kwargs
.
pop
(
"user"
)
super
(
DiskAddForm
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
self
.
initial
[
'is_template'
]
=
1
if
self
.
is_template
is
True
else
0
self
.
initial
[
'object_pk'
]
=
self
.
object_pk
...
...
@@ -771,7 +772,7 @@ class DiskAddForm(forms.Form):
'size'
:
data
[
'size'
],
'dev_num'
:
"a"
,
}
d
=
Disk
.
create_empty
(
instance
=
inst
,
user
=
None
,
**
kwargs
)
d
=
Disk
.
create_empty
(
instance
=
inst
,
user
=
self
.
user
,
**
kwargs
)
else
:
kwargs
=
{
'name'
:
data
[
'name'
],
...
...
@@ -779,7 +780,7 @@ class DiskAddForm(forms.Form):
'dev_num'
:
"a"
,
}
Disk
.
create_from_url_async
(
data
[
'url'
],
instance
=
inst
,
user
=
None
,
**
kwargs
)
user
=
self
.
user
,
**
kwargs
)
d
=
None
return
d
...
...
circle/dashboard/views.py
View file @
0edc8ff2
...
...
@@ -195,6 +195,7 @@ class VmDetailView(CheckedDetailView):
context
[
'acl'
]
=
get_vm_acl_data
(
instance
)
context
[
'forms'
]
=
{
'disk_add_form'
:
DiskAddForm
(
user
=
self
.
request
.
user
,
is_template
=
False
,
object_pk
=
self
.
get_object
()
.
pk
,
prefix
=
"disk"
),
}
...
...
@@ -749,6 +750,7 @@ class TemplateDetail(LoginRequiredMixin, SuccessMessageMixin, UpdateView):
context
[
'acl'
]
=
get_vm_acl_data
(
obj
)
context
[
'disks'
]
=
obj
.
disks
.
all
()
context
[
'disk_add_form'
]
=
DiskAddForm
(
user
=
self
.
request
.
user
,
is_template
=
True
,
object_pk
=
obj
.
pk
,
prefix
=
"disk"
,
...
...
@@ -1756,6 +1758,7 @@ class DiskAddView(TemplateView):
form
=
DiskAddForm
(
self
.
request
.
POST
,
user
=
self
.
request
.
user
,
is_template
=
is_template
,
object_pk
=
object_pk
,
prefix
=
"disk"
)
...
...
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