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
Commit
f3f433d7
authored
Jul 24, 2013
by
Kálmán Viktor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
network: add blacklist views
parent
f4ef13d8
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
95 additions
and
6 deletions
+95
-6
network/forms.py
+30
-1
network/tables.py
+10
-0
network/templates/network/blacklist-edit.html
+14
-0
network/templates/network/blacklist-list.html
+13
-0
network/templates/network/menu.html
+3
-1
network/urls.py
+5
-1
network/views.py
+20
-3
No files found.
network/forms.py
View file @
f3f433d7
...
...
@@ -5,7 +5,7 @@ from crispy_forms.helper import FormHelper
from
crispy_forms.layout
import
Layout
,
Fieldset
,
Row
,
HTML
from
crispy_forms.layout
import
Div
,
ButtonHolder
,
Submit
,
BaseInput
from
firewall.models
import
Host
,
Vlan
,
Domain
,
Group
,
Record
from
firewall.models
import
Host
,
Vlan
,
Domain
,
Group
,
Record
,
Blacklist
class
LinkButton
(
BaseInput
):
...
...
@@ -25,6 +25,35 @@ class LinkButton(BaseInput):
super
(
LinkButton
,
self
)
.
__init__
(
name
,
text
,
*
args
,
**
kwargs
)
class
BlacklistForm
(
ModelForm
):
helper
=
FormHelper
()
helper
.
layout
=
Layout
(
Div
(
Row
(
Div
(
Fieldset
(
'Blacklist detail'
,
'ipv4'
,
'host'
,
'reason'
,
'type'
,
),
css_class
=
'span8'
),
Div
(
HTML
(
'<p>hello</p>'
),
css_class
=
'span4'
),
),
ButtonHolder
(
Submit
(
'submit'
,
'Save'
),
LinkButton
(
'back'
,
'Back'
,
reverse_lazy
(
'network.domain_list'
))
),
css_class
=
"form-horizontal"
))
class
Meta
:
model
=
Blacklist
class
DomainForm
(
ModelForm
):
helper
=
FormHelper
()
helper
.
layout
=
Layout
(
...
...
network/tables.py
View file @
f3f433d7
...
...
@@ -4,6 +4,16 @@ from django_tables2.columns import LinkColumn
from
firewall.models
import
Host
,
Vlan
,
Domain
,
Group
,
Record
class
BlacklistTable
(
Table
):
ipv4
=
LinkColumn
(
'network.blacklist'
,
args
=
[
A
(
'pk'
)])
class
Meta
:
model
=
Domain
attrs
=
{
'class'
:
'table table-striped table-condensed'
}
fields
=
(
'ipv4'
,
'host'
,
'reason'
,
'type'
)
order_by
=
(
'ipv4'
,
)
class
DomainTable
(
Table
):
name
=
LinkColumn
(
'network.domain'
,
args
=
[
A
(
'pk'
)])
...
...
network/templates/network/blacklist-edit.html
0 → 100644
View file @
f3f433d7
{% extends "network/base.html" %}
{% load render_table from django_tables2 %}
{% load i18n %}
{% load l10n %}
{% load staticfiles %}
{% load crispy_forms_tags %}
{% block content %}
<div
class=
"page-heading"
>
<h1>
{{ form.ipv4.value }}
<small>
details of restriction
</small></h1>
</div>
{% crispy form %}
{% endblock %}
network/templates/network/blacklist-list.html
0 → 100644
View file @
f3f433d7
{% extends "network/base.html" %}
{% load render_table from django_tables2 %}
{% load i18n %}
{% load l10n %}
{% load staticfiles %}
{% block content %}
<div
class=
"page-heading"
>
<h1>
Blacklist
<small></small></h1>
</div>
{% render_table table %}
{% endblock %}
network/templates/network/menu.html
View file @
f3f433d7
...
...
@@ -11,8 +11,10 @@
{% include "network/menu-item.html" with href=u text="Groups" %}
{% url network.record_list as u %}
{% include "network/menu-item.html" with href=u text="Records" %}
{% url network.blacklist_list as u %}
{% include "network/menu-item.html" with href=u text="Blacklists" %}
{#
<li><a
href=
"/vlans/"
>
{% trans "Vlans" %}
</a></li>
#}
{#
<li><a
href=
"/vlangroups/"
>
{% trans "Vlan groups" %}
</a></li>
#}
{#
<li><a
href=
"/hostgroups/"
>
{% trans "Host groups" %}
</a></li>
#}
{#
<li><a
href=
"/hosts/"
>
{% trans "Hosts" %}
</a></li>
#}
...
...
network/urls.py
View file @
f3f433d7
...
...
@@ -2,12 +2,16 @@ from django.conf.urls import patterns, url
from
.views
import
(
IndexView
,
HostList
,
HostDetail
,
VlanList
,
VlanDetail
,
DomainList
,
DomainDetail
,
GroupList
,
GroupDetail
,
RecordList
,
RecordDetail
)
RecordList
,
RecordDetail
,
BlacklistList
,
BlacklistDetail
)
urlpatterns
=
patterns
(
''
,
url
(
'^$'
,
IndexView
.
as_view
(),
name
=
'network.index'
),
url
(
'^blacklists/$'
,
BlacklistList
.
as_view
(),
name
=
'network.blacklist_list'
),
url
(
'^blacklists/(?P<pk>
\
d+)/$'
,
BlacklistDetail
.
as_view
(),
name
=
'network.blacklist'
),
url
(
'^domains/$'
,
DomainList
.
as_view
(),
name
=
'network.domain_list'
),
url
(
'^domains/(?P<pk>
\
d+)/$'
,
DomainDetail
.
as_view
(),
name
=
'network.domain'
),
...
...
network/views.py
View file @
f3f433d7
...
...
@@ -4,16 +4,33 @@ from django.core.urlresolvers import reverse_lazy
from
django_tables2
import
SingleTableView
from
firewall.models
import
Host
,
Vlan
,
Domain
,
Group
,
Record
from
firewall.models
import
Host
,
Vlan
,
Domain
,
Group
,
Record
,
Blacklist
from
.tables
import
(
HostTable
,
VlanTable
,
SmallHostTable
,
DomainTable
,
GroupTable
,
RecordTable
)
from
.forms
import
HostForm
,
VlanForm
,
DomainForm
,
GroupForm
,
RecordForm
GroupTable
,
RecordTable
,
BlacklistTable
)
from
.forms
import
(
HostForm
,
VlanForm
,
DomainForm
,
GroupForm
,
RecordForm
,
BlacklistForm
)
class
IndexView
(
TemplateView
):
template_name
=
"network/index.html"
class
BlacklistList
(
SingleTableView
):
model
=
Blacklist
table_class
=
BlacklistTable
template_name
=
"network/blacklist-list.html"
class
BlacklistDetail
(
UpdateView
):
model
=
Blacklist
template_name
=
"network/blacklist-edit.html"
form_class
=
BlacklistForm
def
get_success_url
(
self
):
if
'pk'
in
self
.
kwargs
:
return
reverse_lazy
(
'network.blacklist'
,
kwargs
=
self
.
kwargs
)
class
DomainList
(
SingleTableView
):
model
=
Domain
table_class
=
DomainTable
...
...
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