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
47f5a6b2
authored
Dec 17, 2013
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: number inputs in Lease edit
parent
fcab9aeb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
circle/dashboard/forms.py
+9
-2
No files found.
circle/dashboard/forms.py
View file @
47f5a6b2
...
...
@@ -12,7 +12,7 @@ from crispy_forms.layout import TEMPLATE_PACK
from
crispy_forms.utils
import
render_field
from
django.template
import
Context
from
django.template.loader
import
render_to_string
from
django.forms.widgets
import
TextInput
from
django.utils.translation
import
ugettext
as
_
# from crispy_forms.bootstrap import FormActions
...
...
@@ -343,7 +343,7 @@ class LeaseForm(forms.ModelForm):
for
m
in
methods
:
for
idx
,
i
in
enumerate
(
intervals
):
self
.
fields
[
"
%
s_
%
s"
%
(
m
,
i
)]
=
forms
.
IntegerField
(
min_value
=
0
,
min_value
=
0
,
widget
=
NumberInput
,
initial
=
initial
[
m
]
.
get
(
i
,
0
))
def
save
(
self
,
commit
=
True
):
...
...
@@ -376,6 +376,7 @@ class LeaseForm(forms.ModelForm):
Div
(
HTML
(
_
(
"Suspend in"
)),
css_class
=
"input-group-addon"
,
style
=
"width: 100px;"
,
),
NumberField
(
"suspend_hours"
,
css_class
=
"form-control"
),
Div
(
...
...
@@ -403,6 +404,7 @@ class LeaseForm(forms.ModelForm):
Div
(
HTML
(
_
(
"Delete in"
)),
css_class
=
"input-group-addon"
,
style
=
"width: 100px;"
,
),
NumberField
(
"delete_hours"
,
css_class
=
"form-control"
),
Div
(
...
...
@@ -451,10 +453,15 @@ class LinkButton(BaseInput):
super
(
LinkButton
,
self
)
.
__init__
(
name
,
text
,
*
args
,
**
kwargs
)
class
NumberInput
(
TextInput
):
input_type
=
"number"
class
NumberField
(
Field
):
template
=
"crispy_forms/numberfield.html"
def
__init__
(
self
,
*
args
,
**
kwargs
):
kwargs
[
'min'
]
=
0
super
(
NumberField
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
...
...
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