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
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
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
Hide 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
...
@@ -12,7 +12,7 @@ from crispy_forms.layout import TEMPLATE_PACK
from
crispy_forms.utils
import
render_field
from
crispy_forms.utils
import
render_field
from
django.template
import
Context
from
django.template
import
Context
from
django.template.loader
import
render_to_string
from
django.template.loader
import
render_to_string
from
django.forms.widgets
import
TextInput
from
django.utils.translation
import
ugettext
as
_
from
django.utils.translation
import
ugettext
as
_
# from crispy_forms.bootstrap import FormActions
# from crispy_forms.bootstrap import FormActions
...
@@ -343,7 +343,7 @@ class LeaseForm(forms.ModelForm):
...
@@ -343,7 +343,7 @@ class LeaseForm(forms.ModelForm):
for
m
in
methods
:
for
m
in
methods
:
for
idx
,
i
in
enumerate
(
intervals
):
for
idx
,
i
in
enumerate
(
intervals
):
self
.
fields
[
"
%
s_
%
s"
%
(
m
,
i
)]
=
forms
.
IntegerField
(
self
.
fields
[
"
%
s_
%
s"
%
(
m
,
i
)]
=
forms
.
IntegerField
(
min_value
=
0
,
min_value
=
0
,
widget
=
NumberInput
,
initial
=
initial
[
m
]
.
get
(
i
,
0
))
initial
=
initial
[
m
]
.
get
(
i
,
0
))
def
save
(
self
,
commit
=
True
):
def
save
(
self
,
commit
=
True
):
...
@@ -376,6 +376,7 @@ class LeaseForm(forms.ModelForm):
...
@@ -376,6 +376,7 @@ class LeaseForm(forms.ModelForm):
Div
(
Div
(
HTML
(
_
(
"Suspend in"
)),
HTML
(
_
(
"Suspend in"
)),
css_class
=
"input-group-addon"
,
css_class
=
"input-group-addon"
,
style
=
"width: 100px;"
,
),
),
NumberField
(
"suspend_hours"
,
css_class
=
"form-control"
),
NumberField
(
"suspend_hours"
,
css_class
=
"form-control"
),
Div
(
Div
(
...
@@ -403,6 +404,7 @@ class LeaseForm(forms.ModelForm):
...
@@ -403,6 +404,7 @@ class LeaseForm(forms.ModelForm):
Div
(
Div
(
HTML
(
_
(
"Delete in"
)),
HTML
(
_
(
"Delete in"
)),
css_class
=
"input-group-addon"
,
css_class
=
"input-group-addon"
,
style
=
"width: 100px;"
,
),
),
NumberField
(
"delete_hours"
,
css_class
=
"form-control"
),
NumberField
(
"delete_hours"
,
css_class
=
"form-control"
),
Div
(
Div
(
...
@@ -451,10 +453,15 @@ class LinkButton(BaseInput):
...
@@ -451,10 +453,15 @@ class LinkButton(BaseInput):
super
(
LinkButton
,
self
)
.
__init__
(
name
,
text
,
*
args
,
**
kwargs
)
super
(
LinkButton
,
self
)
.
__init__
(
name
,
text
,
*
args
,
**
kwargs
)
class
NumberInput
(
TextInput
):
input_type
=
"number"
class
NumberField
(
Field
):
class
NumberField
(
Field
):
template
=
"crispy_forms/numberfield.html"
template
=
"crispy_forms/numberfield.html"
def
__init__
(
self
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
kwargs
[
'min'
]
=
0
super
(
NumberField
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
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