Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Gelencsér Szabolcs
/
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
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
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
17 deletions
+12
-17
circle/dashboard/forms.py
+4
-7
circle/dashboard/templates/dashboard/template-edit.html
+7
-10
circle/dashboard/views/template.py
+1
-0
No files found.
circle/dashboard/forms.py
View file @
b63173e2
...
...
@@ -524,10 +524,6 @@ class TemplateForm(forms.ModelForm):
value
=
field
.
widget
.
value_from_datadict
(
self
.
data
,
self
.
files
,
self
.
add_prefix
(
name
))
try
:
if
isinstance
(
field
,
forms
.
FileField
):
initial
=
self
.
initial
.
get
(
name
,
field
.
initial
)
value
=
field
.
clean
(
value
,
initial
)
else
:
value
=
field
.
clean
(
value
)
self
.
cleaned_data
[
name
]
=
value
if
hasattr
(
self
,
'clean_
%
s'
%
name
):
...
...
@@ -544,13 +540,14 @@ class TemplateForm(forms.ModelForm):
else
:
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
):
data
=
self
.
cleaned_data
self
.
instance
.
max_ram_size
=
data
.
get
(
'ram_size'
)
instance
=
super
(
TemplateForm
,
self
)
.
save
(
commit
=
False
)
if
commit
:
instance
.
save
()
instance
=
super
(
TemplateForm
,
self
)
.
save
(
commit
=
True
)
# create and/or delete InterfaceTemplates
networks
=
InterfaceTemplate
.
objects
.
filter
(
...
...
circle/dashboard/templates/dashboard/template-edit.html
View file @
b63173e2
...
...
@@ -23,18 +23,15 @@
{% csrf_token %}
{{ 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>
{% if parent %}
<a
href=
"{% url "
dashboard
.
views
.
template-detail
"
pk=
parent.pk
%}"
>
{{ parent.name }}
</a>
{% else %}
disabled
%}
-
{% endif %}
class=
"btn btn-default pull-right"
style=
"margin-top: 24px;"
>
{% trans "Visit" %}
<i
class=
"fa fa-arrow-circle-right"
></i>
</a>
<div
style=
"width: 80%;"
>
{{ form.parent|as_crispy_field }}
</div>
<fieldset
class=
"resources-sliders"
>
<legend>
{% trans "Resource configuration" %}
</legend>
...
...
circle/dashboard/views/template.py
View file @
b63173e2
...
...
@@ -300,6 +300,7 @@ class TemplateDetail(LoginRequiredMixin, SuccessMessageMixin, UpdateView):
context
[
'disks'
]
=
obj
.
disks
.
all
()
context
[
'is_owner'
]
=
obj
.
has_level
(
self
.
request
.
user
,
'owner'
)
context
[
'aclform'
]
=
AclUserOrGroupAddForm
()
context
[
'parent'
]
=
obj
.
parent
return
context
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