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
dc3697a4
authored
Jun 02, 2014
by
Őry Máté
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dashboard: add GroupProfileUpdateForm
parent
ba33514e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
1 deletions
+34
-1
circle/dashboard/forms.py
+34
-1
No files found.
circle/dashboard/forms.py
View file @
dc3697a4
...
...
@@ -44,7 +44,7 @@ from storage.models import Disk, DataStore
from
vm.models
import
(
InstanceTemplate
,
Lease
,
InterfaceTemplate
,
Node
,
Trait
,
Instance
)
from
.models
import
Profile
from
.models
import
Profile
,
GroupProfile
class
VmCustomizeForm
(
forms
.
Form
):
...
...
@@ -355,6 +355,39 @@ class GroupCreateForm(forms.ModelForm):
fields
=
(
'name'
,
)
class
GroupProfileUpdateForm
(
forms
.
ModelForm
):
def
__init__
(
self
,
*
args
,
**
kwargs
):
new_groups
=
kwargs
.
pop
(
'new_groups'
,
None
)
super
(
GroupProfileUpdateForm
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
choices
=
[(
''
,
'--'
)]
if
new_groups
:
choices
+=
[(
g
,
g
)
for
g
in
new_groups
if
len
(
g
)
<=
64
]
self
.
fields
[
'org_id'
]
=
forms
.
ChoiceField
(
choices
=
choices
,
required
=
False
,
label
=
_
(
'Directory identifier'
))
if
not
new_groups
:
self
.
fields
[
'org_id'
]
.
widget
=
HiddenInput
()
self
.
fields
[
'description'
]
.
widget
=
forms
.
Textarea
(
attrs
=
{
'rows'
:
3
})
@property
def
helper
(
self
):
helper
=
FormHelper
(
self
)
helper
.
add_input
(
Submit
(
"submit"
,
_
(
"Save"
)))
helper
.
form_tag
=
False
return
helper
def
save
(
self
,
commit
=
True
):
profile
=
super
(
GroupProfileUpdateForm
,
self
)
.
save
(
commit
=
False
)
profile
.
org_id
=
self
.
cleaned_data
[
'org_id'
]
or
None
if
commit
:
profile
.
save
()
return
profile
class
Meta
:
model
=
GroupProfile
fields
=
(
'description'
,
'org_id'
)
class
HostForm
(
forms
.
ModelForm
):
def
setowner
(
self
,
user
):
...
...
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