Commit bdd52a80 by Bence Dányi

firewall_gui: list firewall rules

parent 3e5a8828
......@@ -94,4 +94,5 @@ urlpatterns = patterns('',
url(r'^accounts/(?P<site>profile)/$', 'one.views.sites'),
url(r'^firewall/$', 'firewall_gui.views.index'),
url(r'^firewall/rules/$', 'firewall_gui.views.list_rules'),
)
......@@ -14,6 +14,12 @@ import random
settings = django.conf.settings.FIREWALL_SETTINGS
class Rule(models.Model):
"""
Common firewall rule
Rule can be applied to: Host, Firewall, Vlan
"""
CHOICES_type = (('host', 'host'), ('firewall', 'firewall'),
('vlan', 'vlan'))
CHOICES_proto = (('tcp', 'tcp'), ('udp', 'udp'), ('icmp', 'icmp'))
......
{% load i18n %}
{% load l10n %}
{% load staticfiles %}
{% get_current_language as lang %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>{% templatetag openblock %} block title {% templatetag closeblock %}{{ project_name }}{% templatetag openblock %} endblock title {% templatetag closeblock %}</title>
<title>{% block title %}Firewall GUI{% endblock %}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<!-- 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>
body {
padding-top: 60px; /* 60px to make the container go all the way to the bottom of the topbar */
}
</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 -->
<!--[if lt IE 9]>
......@@ -22,11 +26,11 @@
<![endif]-->
<!-- 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 -->
{% templatetag openblock %} block extra_css {% templatetag closeblock %}{% templatetag openblock %} endblock extra_css {% templatetag closeblock %}
{% block extra_css %}{% endblock %}
</head>
<body>
......@@ -53,11 +57,11 @@
<div class="container">
<h1>{% templatetag openblock %} block page_title {% templatetag closeblock %}Example Base Template{% templatetag openblock %} endblock page_title {% templatetag closeblock %}</h1>
<h1>{% block page_title %}Example Base Template{% endblock %}</h1>
{% templatetag openblock %} block content {% templatetag closeblock %}
{% block content %}
<p>Use this document as a way to quick start any new project.</p>
{% templatetag openblock %} endblock content {% templatetag closeblock %}
{% endblock %}
</div> <!-- /container -->
......@@ -68,8 +72,8 @@
<script src="{% templatetag openvariable %} STATIC_URL {% templatetag closevariable %}js/bootstrap.min.js"></script>
<!-- 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 closeblock %}
{% block extra_js %} {% endblock %}
</body>
</html>
{% extends "base2.html" %}
{% block content %}
{% for rule in rules %}
<li>{{rule}}</li>
{% endfor %}
{% endblock %}
from django.http import HttpResponse
from django.shortcuts import render
from firewall.fw import *
from firewall.models import *
def index(request):
return HttpResponse("Ez itt a bd tuzfaladminja.")
def list_rules(request):
rules = Rule.objects.all()
return render(request, 'rule/list.html', {
'rules': rules,
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment