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
9958e0cb
authored
Sep 23, 2014
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: fixed VmDiskResizeForm clean()
parent
88536752
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
circle/dashboard/forms.py
+7
-2
No files found.
circle/dashboard/forms.py
View file @
9958e0cb
...
@@ -809,12 +809,17 @@ class VmDiskResizeForm(forms.Form):
...
@@ -809,12 +809,17 @@ class VmDiskResizeForm(forms.Form):
queryset
=
choices
,
initial
=
default
,
required
=
True
,
queryset
=
choices
,
initial
=
default
,
required
=
True
,
empty_label
=
None
,
label
=
_
(
'Disk'
)))
empty_label
=
None
,
label
=
_
(
'Disk'
)))
def
clean_size
(
self
):
def
clean
(
self
):
cleaned_data
=
super
(
VmDiskResizeForm
,
self
)
.
clean
()
size_in_bytes
=
self
.
cleaned_data
.
get
(
"size"
)
size_in_bytes
=
self
.
cleaned_data
.
get
(
"size"
)
disk
=
self
.
cleaned_data
.
get
(
'disk'
)
if
not
size_in_bytes
.
isdigit
()
and
len
(
size_in_bytes
)
>
0
:
if
not
size_in_bytes
.
isdigit
()
and
len
(
size_in_bytes
)
>
0
:
raise
forms
.
ValidationError
(
_
(
"Invalid format, you can use "
raise
forms
.
ValidationError
(
_
(
"Invalid format, you can use "
" GB or MB!"
))
" GB or MB!"
))
return
size_in_bytes
if
float
(
size_in_bytes
)
<
float
(
disk
.
size
):
raise
forms
.
ValidationError
(
_
(
"Disk size must be greater than the "
"actual size."
))
return
cleaned_data
@property
@property
def
helper
(
self
):
def
helper
(
self
):
...
...
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