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
Commit
bdd52a80
authored
Apr 23, 2013
by
Bence Dányi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall_gui: list firewall rules
parent
3e5a8828
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
39 additions
and
10 deletions
+39
-10
cloud/urls.py
+1
-0
firewall/models.py
+6
-0
firewall_gui/templates/base2.html
+14
-10
firewall_gui/templates/rule/list.html
+7
-0
firewall_gui/views.py
+11
-0
No files found.
cloud/urls.py
View file @
bdd52a80
...
@@ -94,4 +94,5 @@ urlpatterns = patterns('',
...
@@ -94,4 +94,5 @@ urlpatterns = patterns('',
url
(
r'^accounts/(?P<site>profile)/$'
,
'one.views.sites'
),
url
(
r'^accounts/(?P<site>profile)/$'
,
'one.views.sites'
),
url
(
r'^firewall/$'
,
'firewall_gui.views.index'
),
url
(
r'^firewall/$'
,
'firewall_gui.views.index'
),
url
(
r'^firewall/rules/$'
,
'firewall_gui.views.list_rules'
),
)
)
firewall/models.py
View file @
bdd52a80
...
@@ -14,6 +14,12 @@ import random
...
@@ -14,6 +14,12 @@ import random
settings
=
django
.
conf
.
settings
.
FIREWALL_SETTINGS
settings
=
django
.
conf
.
settings
.
FIREWALL_SETTINGS
class
Rule
(
models
.
Model
):
class
Rule
(
models
.
Model
):
"""
Common firewall rule
Rule can be applied to: Host, Firewall, Vlan
"""
CHOICES_type
=
((
'host'
,
'host'
),
(
'firewall'
,
'firewall'
),
CHOICES_type
=
((
'host'
,
'host'
),
(
'firewall'
,
'firewall'
),
(
'vlan'
,
'vlan'
))
(
'vlan'
,
'vlan'
))
CHOICES_proto
=
((
'tcp'
,
'tcp'
),
(
'udp'
,
'udp'
),
(
'icmp'
,
'icmp'
))
CHOICES_proto
=
((
'tcp'
,
'tcp'
),
(
'udp'
,
'udp'
),
(
'icmp'
,
'icmp'
))
...
...
firewall_gui/templates/base.html
→
firewall_gui/templates/base
2
.html
View file @
bdd52a80
{% load i18n %}
{% load l10n %}
{% load staticfiles %}
{% get_current_language as lang %}
<!DOCTYPE html>
<!DOCTYPE html>
<html
lang=
"en"
>
<html
lang=
"en"
>
<head>
<head>
<meta
charset=
"utf-8"
>
<meta
charset=
"utf-8"
>
<title>
{%
templatetag openblock %} block title {% templatetag closeblock %}{{ project_name }}{% templatetag openblock %} endblock title {% templatetag close
block %}
</title>
<title>
{%
block title %}Firewall GUI{% end
block %}
</title>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
<meta
name=
"description"
content=
""
>
<meta
name=
"description"
content=
""
>
<meta
name=
"author"
content=
""
>
<meta
name=
"author"
content=
""
>
<!-- Le styles -->
<!-- Le styles -->
<link
href=
"{%
templatetag openvariable %} STATIC_URL {% templatetag closevariable %}css/bootstrap.min.css
"
rel=
"stylesheet"
>
<link
href=
"{%
static "
css
/
bootstrap
.
min
.
css
"
%}
"
rel=
"stylesheet"
>
<style>
<style>
body
{
body
{
padding-top
:
60px
;
/* 60px to make the container go all the way to the bottom of the topbar */
padding-top
:
60px
;
/* 60px to make the container go all the way to the bottom of the topbar */
}
}
</style>
</style>
<link
href=
"{%
templatetag openvariable %} STATIC_URL {% templatetag closevariable %}css/bootstrap-responsive.min.css
"
rel=
"stylesheet"
>
<link
href=
"{%
static "
css
/
bootstrap-responsive
.
min
.
css
"
%}
"
rel=
"stylesheet"
>
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<!--[if lt IE 9]>
...
@@ -22,11 +26,11 @@
...
@@ -22,11 +26,11 @@
<![endif]-->
<![endif]-->
<!-- This file store project specific CSS -->
<!-- This file store project specific CSS -->
<link
href=
"{%
templatetag openvariable %} STATIC_URL {% templatetag closevariable %}css/project.css
"
rel=
"stylesheet"
>
<link
href=
"{%
static "
css
/
project
.
css
"
%}
"
rel=
"stylesheet"
>
<!-- Use this to quickly test CSS changes in a template,
<!-- Use this to quickly test CSS changes in a template,
then move to project.css -->
then move to project.css -->
{%
templatetag openblock %} block extra_css {% templatetag closeblock %}{% templatetag openblock %} endblock extra_css {% templatetag close
block %}
{%
block extra_css %}{% end
block %}
</head>
</head>
<body>
<body>
...
@@ -53,11 +57,11 @@
...
@@ -53,11 +57,11 @@
<div
class=
"container"
>
<div
class=
"container"
>
<h1>
{%
templatetag openblock %} block page_title {% templatetag closeblock %}Example Base Template{% templatetag openblock %} endblock page_title {% templatetag close
block %}
</h1>
<h1>
{%
block page_title %}Example Base Template{% end
block %}
</h1>
{%
templatetag openblock %} block content {% templatetag closeblock
%}
{%
block content
%}
<p>
Use this document as a way to quick start any new project.
</p>
<p>
Use this document as a way to quick start any new project.
</p>
{%
templatetag openblock %} endblock content {% templatetag close
block %}
{%
end
block %}
</div>
<!-- /container -->
</div>
<!-- /container -->
...
@@ -68,8 +72,8 @@
...
@@ -68,8 +72,8 @@
<script
src=
"{% templatetag openvariable %} STATIC_URL {% templatetag closevariable %}js/bootstrap.min.js"
></script>
<script
src=
"{% templatetag openvariable %} STATIC_URL {% templatetag closevariable %}js/bootstrap.min.js"
></script>
<!-- place project specific Javascript in this file -->
<!-- place project specific Javascript in this file -->
<script
src=
"{%
templatetag openvariable %} STATIC_URL {% templatetag closevariable %}js/project.js
"
></script>
<script
src=
"{%
static "
js
/
project
.
js
"
%}
"
></script>
{%
templatetag openblock %} block extra_js {% templatetag closeblock %}{% templatetag openblock %} endblock extra_js {% templatetag close
block %}
{%
block extra_js %} {% end
block %}
</body>
</body>
</html>
</html>
firewall_gui/templates/rule/list.html
0 → 100644
View file @
bdd52a80
{% extends "base2.html" %}
{% block content %}
{% for rule in rules %}
<li>
{{rule}}
</li>
{% endfor %}
{% endblock %}
firewall_gui/views.py
View file @
bdd52a80
from
django.http
import
HttpResponse
from
django.http
import
HttpResponse
from
django.shortcuts
import
render
from
firewall.fw
import
*
from
firewall.models
import
*
def
index
(
request
):
def
index
(
request
):
return
HttpResponse
(
"Ez itt a bd tuzfaladminja."
)
return
HttpResponse
(
"Ez itt a bd tuzfaladminja."
)
def
list_rules
(
request
):
rules
=
Rule
.
objects
.
all
()
return
render
(
request
,
'rule/list.html'
,
{
'rules'
:
rules
,
})
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