Commit e909d437 authored by Bonnegent Sebastien's avatar Bonnegent Sebastien
Browse files

ubiquity pour fwm4

parent 659366fb
Pipeline #12201 passed with stages
in 16 seconds
......@@ -42,6 +42,7 @@ INSTALLED_APPS = [
'webui',
'django_extensions',
# @u:start installed_apps
# @u:Keywords bootstrap fontawesome
'bootstrap',
'fontawesome',
# @u:end installed_apps
......
......@@ -16,12 +16,14 @@ Including another URLconf
from django.contrib import admin
from django.urls import path, include
# @u:start import_views
# @u:Keywords webui views
from webui import views
# @u:end import_views
urlpatterns = [
path('admin/', admin.site.urls),
# @u:start home
# @u:Keywords home home_v2
path('', views.home_v2, name='home'),
# @u:end home
path('accounts/', include('django.contrib.auth.urls')),
......
from django.contrib import admin
from .models import Adresse, Port, Service, Groupe, Parefeu, Regle
from .models import Adresse, Port, Service, Groupe
# @u:start import
# @u:Keywords Parefeu Regle
from .models import Parefeu, Regle
# @u:end import
class AdresseAdmin(admin.ModelAdmin):
......@@ -31,6 +35,7 @@ class GroupeAdmin(admin.ModelAdmin):
admin.site.register(Groupe, GroupeAdmin)
# @u:start parefeu_admin
# @u:Keywords ParefeuAdmin list_display date_hierarchy nombre_de_regles
class ParefeuAdmin(admin.ModelAdmin):
list_display = ("nom", "modele",
"nombre_de_regles", "modification")
......@@ -41,6 +46,7 @@ admin.site.register(Parefeu, ParefeuAdmin)
# @u:end parefeu_admin
# @u:start regle_admin
# @u:Keywords RegleAdmin list_display liste_des_services
class RegleAdmin(admin.ModelAdmin):
list_display = ("parefeu", "priorite", "groupe", "liste_des_services", "interface", "sens", "actif")
......
from django.db import models
# @u:start import
# @u:Keywords User
from django.contrib.auth.models import User
# @u:end import
......@@ -68,6 +69,8 @@ class Groupe(AvecNom):
return ", ".join([str(a) for a in self.adresses.all()])
# @u:start parefeu
# @u:Keywords Parefeu AvecNom modification modele admin
# @u:KeywordsNotIn nom
class Parefeu(AvecNom):
# mise à jour auto à chaque save()
modification = models.DateTimeField(auto_now=True)
......@@ -80,6 +83,7 @@ class Parefeu(AvecNom):
# @u:end parefeu
# @u:start nbregles
# @u:Keywords nombre_de_regles self.modele.nombre_de_regles count
def nombre_de_regles(self):
nb = self.regle_set.count()
if self.modele:
......@@ -89,6 +93,7 @@ class Parefeu(AvecNom):
# @u:start regle
# @u:Keywords SENS Regle priorite groupe services interface actif sens parefeu PositiveIntegerField ForeignKey ManyToManyField
SENS = (("i", "Input"), ("f", "Forward"), ("o", "Output"))
class Regle(models.Model):
......@@ -105,11 +110,13 @@ class Regle(models.Model):
# @u:end regle
# @u:start regle_meta
# @u:Keywords Meta ordering parefeu priorite
class Meta(object):
ordering = ("parefeu", "priorite", "groupe")
# @u:end regle_meta
# @u:start regle_services
# @u:Keywords liste_des_services self.services.all
def liste_des_services(self):
return ", ".join([str(s) for s in self.services.all()])
# @u:end regle_services
......@@ -8,6 +8,7 @@
</head>
<body>
<!-- @u:start menu -->
<!-- @u:Keywords navbar ul Admin Parefeux Services Ports -->
<nav class="navbar navbar-expand-md navbar-dark bg-dark mb-4">
<a class="navbar-brand" href="{% url 'home' %}">WebUI</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
......
from django.shortcuts import render
# @u:start httpresponse
# @u:Keywords HttpResponse
from django.http import HttpResponse
# @u:end httpresponse
# @u:start home_v1
# @u:Keywords home_v1 HttpResponse
def home_v1(request):
return HttpResponse('ça marche !')
# @u:end home_v1
# @u:start home_v2
# @u:Keywords home_v2 render request home.html
def home_v2(request):
return render(request, 'webui/home.html', {})
# @u:end home_v2
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 to comment