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
98c460a0
authored
Aug 25, 2014
by
Guba Sándor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add form
parent
7da7ef22
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
0 deletions
+36
-0
circle/dashboard/forms.py
+36
-0
No files found.
circle/dashboard/forms.py
View file @
98c460a0
...
@@ -56,6 +56,9 @@ from django.utils.translation import string_concat
...
@@ -56,6 +56,9 @@ from django.utils.translation import string_concat
from
.virtvalidator
import
domain_validator
from
.virtvalidator
import
domain_validator
from
dashboard.models
import
ConnectCommand
from
vm.models.instance
import
ACCESS_METHODS
LANGUAGES_WITH_CODE
=
((
l
[
0
],
string_concat
(
l
[
1
],
" ("
,
l
[
0
],
")"
))
LANGUAGES_WITH_CODE
=
((
l
[
0
],
string_concat
(
l
[
1
],
" ("
,
l
[
0
],
")"
))
for
l
in
LANGUAGES
)
for
l
in
LANGUAGES
)
...
@@ -1037,6 +1040,39 @@ class UserKeyForm(forms.ModelForm):
...
@@ -1037,6 +1040,39 @@ class UserKeyForm(forms.ModelForm):
return
super
(
UserKeyForm
,
self
)
.
clean
()
return
super
(
UserKeyForm
,
self
)
.
clean
()
class
ConnectCommandForm
(
forms
.
ModelForm
):
access_method
=
forms
.
ChoiceField
(
ACCESS_METHODS
,
required
=
True
,
label
=
_
(
'Access method'
))
application
=
forms
.
CharField
(
required
=
False
,
label
=
_
(
'Application'
),
help_text
=
_
(
'This will be the value of the '
'
%(app)
s parameter.'
))
template
=
forms
.
CharField
(
label
=
_
(
'Template'
),
required
=
True
,
help_text
=
_
(
'This will be the connection command template. '
'Available parameters are: username, '
'host, port, password, app.'
'Example:
%(app)
s -p
%(password)
s
%(host)
s'
))
class
Meta
:
fields
=
(
'access_method'
,
'application'
,
'template'
)
model
=
ConnectCommand
@property
def
helper
(
self
):
helper
=
FormHelper
()
helper
.
add_input
(
Submit
(
"submit"
,
_
(
"Save"
)))
return
helper
def
__init__
(
self
,
*
args
,
**
kwargs
):
self
.
user
=
kwargs
.
pop
(
"user"
,
None
)
super
(
ConnectCommandForm
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
def
clean
(
self
):
if
self
.
user
:
self
.
instance
.
user
=
self
.
user
return
super
(
ConnectCommandForm
,
self
)
.
clean
()
class
TraitsForm
(
forms
.
ModelForm
):
class
TraitsForm
(
forms
.
ModelForm
):
class
Meta
:
class
Meta
:
...
...
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