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
b63173e2
authored
Sep 24, 2014
by
Bach Dániel
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'issue-292' into 'master'
Template traits and tags aren't editable
parents
986920ab
86cd1095
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
20 deletions
+15
-20
circle/dashboard/forms.py
+5
-8
circle/dashboard/templates/dashboard/template-edit.html
+9
-12
circle/dashboard/views/template.py
+1
-0
No files found.
circle/dashboard/forms.py
View file @
b63173e2
...
@@ -524,11 +524,7 @@ class TemplateForm(forms.ModelForm):
...
@@ -524,11 +524,7 @@ class TemplateForm(forms.ModelForm):
value
=
field
.
widget
.
value_from_datadict
(
value
=
field
.
widget
.
value_from_datadict
(
self
.
data
,
self
.
files
,
self
.
add_prefix
(
name
))
self
.
data
,
self
.
files
,
self
.
add_prefix
(
name
))
try
:
try
:
if
isinstance
(
field
,
forms
.
FileField
):
value
=
field
.
clean
(
value
)
initial
=
self
.
initial
.
get
(
name
,
field
.
initial
)
value
=
field
.
clean
(
value
,
initial
)
else
:
value
=
field
.
clean
(
value
)
self
.
cleaned_data
[
name
]
=
value
self
.
cleaned_data
[
name
]
=
value
if
hasattr
(
self
,
'clean_
%
s'
%
name
):
if
hasattr
(
self
,
'clean_
%
s'
%
name
):
value
=
getattr
(
self
,
'clean_
%
s'
%
name
)()
value
=
getattr
(
self
,
'clean_
%
s'
%
name
)()
...
@@ -544,13 +540,14 @@ class TemplateForm(forms.ModelForm):
...
@@ -544,13 +540,14 @@ class TemplateForm(forms.ModelForm):
else
:
else
:
self
.
cleaned_data
[
name
]
=
getattr
(
old
,
name
)
self
.
cleaned_data
[
name
]
=
getattr
(
old
,
name
)
if
"req_traits"
not
in
self
.
allowed_fields
:
self
.
cleaned_data
[
'req_traits'
]
=
self
.
instance
.
req_traits
.
all
()
def
save
(
self
,
commit
=
True
):
def
save
(
self
,
commit
=
True
):
data
=
self
.
cleaned_data
data
=
self
.
cleaned_data
self
.
instance
.
max_ram_size
=
data
.
get
(
'ram_size'
)
self
.
instance
.
max_ram_size
=
data
.
get
(
'ram_size'
)
instance
=
super
(
TemplateForm
,
self
)
.
save
(
commit
=
False
)
instance
=
super
(
TemplateForm
,
self
)
.
save
(
commit
=
True
)
if
commit
:
instance
.
save
()
# create and/or delete InterfaceTemplates
# create and/or delete InterfaceTemplates
networks
=
InterfaceTemplate
.
objects
.
filter
(
networks
=
InterfaceTemplate
.
objects
.
filter
(
...
...
circle/dashboard/templates/dashboard/template-edit.html
View file @
b63173e2
...
@@ -23,18 +23,15 @@
...
@@ -23,18 +23,15 @@
{% csrf_token %}
{% csrf_token %}
{{ form.name|as_crispy_field }}
{{ form.name|as_crispy_field }}
<a
{%
if
form
.
parent
.
value
%}
href=
"{% url "
dashboard
.
views
.
template-detail
"
pk=
form.parent.value
%}"
<strong>
{% trans "Parent template" %}:
</strong>
{%
else
%}
{% if parent %}
disabled
%}
<a
href=
"{% url "
dashboard
.
views
.
template-detail
"
pk=
parent.pk
%}"
>
{%
endif
%}
{{ parent.name }}
class=
"btn btn-default pull-right"
style=
"margin-top: 24px;"
>
</a>
{% trans "Visit" %}
{% else %}
<i
class=
"fa fa-arrow-circle-right"
></i>
-
</a>
{% endif %}
<div
style=
"width: 80%;"
>
{{ form.parent|as_crispy_field }}
</div>
<fieldset
class=
"resources-sliders"
>
<fieldset
class=
"resources-sliders"
>
<legend>
{% trans "Resource configuration" %}
</legend>
<legend>
{% trans "Resource configuration" %}
</legend>
...
...
circle/dashboard/views/template.py
View file @
b63173e2
...
@@ -300,6 +300,7 @@ class TemplateDetail(LoginRequiredMixin, SuccessMessageMixin, UpdateView):
...
@@ -300,6 +300,7 @@ class TemplateDetail(LoginRequiredMixin, SuccessMessageMixin, UpdateView):
context
[
'disks'
]
=
obj
.
disks
.
all
()
context
[
'disks'
]
=
obj
.
disks
.
all
()
context
[
'is_owner'
]
=
obj
.
has_level
(
self
.
request
.
user
,
'owner'
)
context
[
'is_owner'
]
=
obj
.
has_level
(
self
.
request
.
user
,
'owner'
)
context
[
'aclform'
]
=
AclUserOrGroupAddForm
()
context
[
'aclform'
]
=
AclUserOrGroupAddForm
()
context
[
'parent'
]
=
obj
.
parent
return
context
return
context
def
get_success_url
(
self
):
def
get_success_url
(
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