Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
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
153fcaf7
authored
Sep 10, 2013
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
network: add rule button for host and host group views
parent
70d6e5f8
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
0 deletions
+11
-0
circle/network/templates/network/group-edit.html
+1
-0
circle/network/templates/network/host-edit.html
+1
-0
circle/network/views.py
+9
-0
No files found.
circle/network/templates/network/group-edit.html
View file @
153fcaf7
...
...
@@ -17,6 +17,7 @@
</div>
<div
class=
"col-sm-5 col-sm-offset-1"
>
<div
class=
"page-header"
>
<a
href=
"{% url "
network
.
rule_create
"
%}?
hostgroup=
{{
group_pk
}}"
class=
"btn btn-success pull-right btn-xs"
><i
class=
"icon-plus-sign"
></i>
{% trans "Add new rule" %}
</a>
<h3>
{% trans "Rules" %}
</h3>
</div>
{% if rule_list.data.data.count > 0 %}
...
...
circle/network/templates/network/host-edit.html
View file @
153fcaf7
...
...
@@ -17,6 +17,7 @@
</div>
<div
class=
"col-sm-4"
>
<div
class=
"page-header"
>
<a
href=
"{% url "
network
.
rule_create
"
%}?
host=
{{
host_pk
}}"
class=
"btn btn-success pull-right btn-xs"
><i
class=
"icon-plus-sign"
></i>
{% trans "Add new rule" %}
</a>
<h3>
{% trans "Rules" %}
</h3>
</div>
{% if rule_list.data.data.count > 0 %}
...
...
circle/network/views.py
View file @
153fcaf7
...
...
@@ -246,6 +246,8 @@ class GroupDetail(UpdateView, SuccessMessageMixin):
def
get_context_data
(
self
,
*
args
,
**
kwargs
):
context
=
super
(
GroupDetail
,
self
)
.
get_context_data
(
**
kwargs
)
context
[
'group_pk'
]
=
self
.
object
.
pk
# records
q
=
Rule
.
objects
.
filter
(
hostgroup
=
self
.
object
)
context
[
'rule_list'
]
=
SmallRuleTable
(
q
)
...
...
@@ -475,6 +477,13 @@ class RuleCreate(CreateView, SuccessMessageMixin):
form_class
=
RuleForm
success_message
=
_
(
u'Successfully created rule!'
)
def
get_initial
(
self
):
return
{
# 'owner': 1,
'host'
:
self
.
request
.
GET
.
get
(
'host'
),
'hostgroup'
:
self
.
request
.
GET
.
get
(
'hostgroup'
)
}
class
RuleDelete
(
DeleteView
):
model
=
Rule
...
...
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