Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gutyán Gábor
/
circlestack
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
b57d742b
authored
Sep 24, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: allow choosing disk in resize form
parent
4ca21fef
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
4 deletions
+10
-4
circle/dashboard/forms.py
+8
-2
circle/dashboard/views/vm.py
+2
-2
No files found.
circle/dashboard/forms.py
View file @
b57d742b
...
@@ -801,13 +801,15 @@ class VmDiskResizeForm(forms.Form):
...
@@ -801,13 +801,15 @@ class VmDiskResizeForm(forms.Form):
def
__init__
(
self
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
choices
=
kwargs
.
pop
(
'choices'
)
choices
=
kwargs
.
pop
(
'choices'
)
default
=
kwargs
.
pop
(
'default'
)
self
.
disk
=
kwargs
.
pop
(
'default'
)
super
(
VmDiskResizeForm
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
super
(
VmDiskResizeForm
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
self
.
fields
.
insert
(
0
,
'disk'
,
forms
.
ModelChoiceField
(
self
.
fields
.
insert
(
0
,
'disk'
,
forms
.
ModelChoiceField
(
queryset
=
choices
,
initial
=
default
,
required
=
True
,
queryset
=
choices
,
initial
=
self
.
disk
,
required
=
True
,
empty_label
=
None
,
label
=
_
(
'Disk'
)))
empty_label
=
None
,
label
=
_
(
'Disk'
)))
if
self
.
disk
:
self
.
fields
[
'disk'
]
.
widget
=
HiddenInput
()
def
clean
(
self
):
def
clean
(
self
):
cleaned_data
=
super
(
VmDiskResizeForm
,
self
)
.
clean
()
cleaned_data
=
super
(
VmDiskResizeForm
,
self
)
.
clean
()
...
@@ -825,6 +827,10 @@ class VmDiskResizeForm(forms.Form):
...
@@ -825,6 +827,10 @@ class VmDiskResizeForm(forms.Form):
def
helper
(
self
):
def
helper
(
self
):
helper
=
FormHelper
(
self
)
helper
=
FormHelper
(
self
)
helper
.
form_tag
=
False
helper
.
form_tag
=
False
if
self
.
disk
:
helper
.
layout
=
Layout
(
HTML
(
_
(
"<label>Disk:</label>
%
s"
)
%
self
.
disk
),
Field
(
'disk'
),
Field
(
'size'
))
return
helper
return
helper
...
...
circle/dashboard/views/vm.py
View file @
b57d742b
...
@@ -380,9 +380,9 @@ class VmDiskResizeView(FormOperationMixin, VmOperationView):
...
@@ -380,9 +380,9 @@ class VmDiskResizeView(FormOperationMixin, VmOperationView):
try
:
try
:
default
=
choices
.
get
(
pk
=
disk_pk
)
default
=
choices
.
get
(
pk
=
disk_pk
)
except
(
ValueError
,
Disk
.
DoesNotExist
):
except
(
ValueError
,
Disk
.
DoesNotExist
):
raise
SuspiciousOperation
()
raise
Http404
()
else
:
else
:
raise
SuspiciousOperation
()
default
=
None
val
=
super
(
VmDiskResizeView
,
self
)
.
get_form_kwargs
()
val
=
super
(
VmDiskResizeView
,
self
)
.
get_form_kwargs
()
val
.
update
({
'choices'
:
choices
,
'default'
:
default
})
val
.
update
({
'choices'
:
choices
,
'default'
:
default
})
...
...
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