2017-09-10 14:53:02 +00:00
|
|
|
# -*- mode: python; coding: utf-8 -*-
|
2017-06-25 22:50:55 +00:00
|
|
|
# Re2o un logiciel d'administration développé initiallement au rezometz. Il
|
|
|
|
# se veut agnostique au réseau considéré, de manière à être installable en
|
|
|
|
# quelques clics.
|
|
|
|
#
|
|
|
|
# Copyright © 2017 Gabriel Détraz
|
|
|
|
# Copyright © 2017 Goulven Kermarec
|
|
|
|
# Copyright © 2017 Augustin Lemesle
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License along
|
|
|
|
# with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
|
2017-09-10 23:29:24 +00:00
|
|
|
from __future__ import unicode_literals
|
2017-06-25 22:50:55 +00:00
|
|
|
|
|
|
|
from django.db import models
|
2017-06-26 17:23:01 +00:00
|
|
|
from cotisations.models import Paiement
|
2017-08-26 13:10:18 +00:00
|
|
|
from machines.models import Vlan
|
2017-06-25 22:50:55 +00:00
|
|
|
|
|
|
|
class OptionalUser(models.Model):
|
2017-08-24 19:36:59 +00:00
|
|
|
PRETTY_NAME = "Options utilisateur"
|
|
|
|
|
2017-06-25 22:50:55 +00:00
|
|
|
is_tel_mandatory = models.BooleanField(default=True)
|
|
|
|
user_solde = models.BooleanField(default=False)
|
2017-06-26 17:23:01 +00:00
|
|
|
solde_negatif = models.DecimalField(max_digits=5, decimal_places=2, default=0)
|
2017-06-25 22:50:55 +00:00
|
|
|
gpg_fingerprint = models.BooleanField(default=True)
|
|
|
|
|
2017-06-26 17:23:01 +00:00
|
|
|
def clean(self):
|
|
|
|
if self.user_solde:
|
|
|
|
Paiement.objects.get_or_create(moyen="Solde")
|
|
|
|
|
2017-06-25 22:50:55 +00:00
|
|
|
class OptionalMachine(models.Model):
|
2017-08-24 19:36:59 +00:00
|
|
|
PRETTY_NAME = "Options machines"
|
|
|
|
|
2017-06-25 22:50:55 +00:00
|
|
|
password_machine = models.BooleanField(default=False)
|
|
|
|
max_lambdauser_interfaces = models.IntegerField(default=10)
|
|
|
|
max_lambdauser_aliases = models.IntegerField(default=10)
|
2017-10-03 00:36:39 +00:00
|
|
|
ipv6 = models.BooleanField(default=False)
|
2017-06-25 22:50:55 +00:00
|
|
|
|
2017-08-26 13:10:18 +00:00
|
|
|
class OptionalTopologie(models.Model):
|
|
|
|
PRETTY_NAME = "Options topologie"
|
2017-09-02 13:20:44 +00:00
|
|
|
MACHINE = 'MACHINE'
|
|
|
|
DEFINED = 'DEFINED'
|
|
|
|
CHOICE_RADIUS = (
|
|
|
|
(MACHINE, 'Sur le vlan de la plage ip machine'),
|
|
|
|
(DEFINED, 'Prédéfini dans "Vlan où placer les machines après acceptation RADIUS"'),
|
|
|
|
)
|
2017-06-25 22:50:55 +00:00
|
|
|
|
2017-09-10 16:16:59 +00:00
|
|
|
|
2017-09-02 13:20:44 +00:00
|
|
|
radius_general_policy = models.CharField(max_length=32, choices=CHOICE_RADIUS, default='DEFINED')
|
2017-08-26 13:10:18 +00:00
|
|
|
vlan_decision_ok = models.OneToOneField('machines.Vlan', on_delete=models.PROTECT, related_name='decision_ok', blank=True, null=True)
|
|
|
|
vlan_decision_nok = models.OneToOneField('machines.Vlan', on_delete=models.PROTECT, related_name='decision_nok', blank=True, null=True)
|
2017-06-25 22:50:55 +00:00
|
|
|
|
|
|
|
class GeneralOption(models.Model):
|
2017-08-24 19:36:59 +00:00
|
|
|
PRETTY_NAME = "Options générales"
|
|
|
|
|
2017-06-25 22:50:55 +00:00
|
|
|
search_display_page = models.IntegerField(default=15)
|
|
|
|
pagination_number = models.IntegerField(default=25)
|
|
|
|
pagination_large_number = models.IntegerField(default=8)
|
2017-08-26 14:04:51 +00:00
|
|
|
req_expire_hrs = models.IntegerField(default=48)
|
|
|
|
site_name = models.CharField(max_length=32, default="Re2o")
|
|
|
|
email_from = models.EmailField(default="www-data@serveur.net")
|
2017-06-25 22:50:55 +00:00
|
|
|
|
2017-08-24 19:36:59 +00:00
|
|
|
class Service(models.Model):
|
|
|
|
name = models.CharField(max_length=32)
|
|
|
|
url = models.URLField()
|
|
|
|
description = models.TextField()
|
|
|
|
image = models.ImageField(upload_to='logo', blank=True)
|
|
|
|
|
2017-08-25 02:35:49 +00:00
|
|
|
def __str__(self):
|
|
|
|
return str(self.name)
|
|
|
|
|
2017-08-24 19:36:59 +00:00
|
|
|
class AssoOption(models.Model):
|
|
|
|
PRETTY_NAME = "Options de l'association"
|
|
|
|
|
|
|
|
name = models.CharField(default="Association réseau école machin", max_length=256)
|
|
|
|
siret = models.CharField(default="00000000000000", max_length=32)
|
|
|
|
adresse1 = models.CharField(default="1 Rue de exemple", max_length=128)
|
|
|
|
adresse2 = models.CharField(default="94230 Cachan", max_length=128)
|
|
|
|
contact = models.EmailField(default="contact@example.org")
|
|
|
|
telephone = models.CharField(max_length=15, default="0000000000")
|
|
|
|
pseudo = models.CharField(default="Asso", max_length=32)
|
|
|
|
utilisateur_asso = models.OneToOneField('users.User', on_delete=models.PROTECT, blank=True, null=True)
|
2017-09-08 20:53:13 +00:00
|
|
|
|
|
|
|
class MailMessageOption(models.Model):
|
|
|
|
PRETTY_NAME = "Options de corps de mail"
|
|
|
|
|
|
|
|
welcome_mail_fr = models.TextField(default="")
|
|
|
|
welcome_mail_en = models.TextField(default="")
|
|
|
|
|