mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-23 11:53:12 +00:00
Borde un certain nombre d'integer qui ont des range de valeur défini dans les RFC
This commit is contained in:
parent
af0c4cafcc
commit
3b686cfd29
8 changed files with 157 additions and 15 deletions
26
cotisations/migrations/0024_auto_20171015_2033.py
Normal file
26
cotisations/migrations/0024_auto_20171015_2033.py
Normal file
|
@ -0,0 +1,26 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.7 on 2017-10-15 18:33
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import django.core.validators
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('cotisations', '0023_auto_20170902_1303'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='article',
|
||||
name='duration',
|
||||
field=models.PositiveIntegerField(blank=True, help_text='Durée exprimée en mois entiers', null=True, validators=[django.core.validators.MinValueValidator(0)]),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='vente',
|
||||
name='duration',
|
||||
field=models.PositiveIntegerField(blank=True, help_text='Durée exprimée en mois entiers', null=True),
|
||||
),
|
||||
]
|
|
@ -132,7 +132,7 @@ class Vente(models.Model):
|
|||
name = models.CharField(max_length=255)
|
||||
prix = models.DecimalField(max_digits=5, decimal_places=2)
|
||||
iscotisation = models.BooleanField()
|
||||
duration = models.IntegerField(
|
||||
duration = models.PositiveIntegerField(
|
||||
help_text="Durée exprimée en mois entiers",
|
||||
blank=True,
|
||||
null=True)
|
||||
|
@ -222,7 +222,7 @@ class Article(models.Model):
|
|||
name = models.CharField(max_length=255, unique=True)
|
||||
prix = models.DecimalField(max_digits=5, decimal_places=2)
|
||||
iscotisation = models.BooleanField()
|
||||
duration = models.IntegerField(
|
||||
duration = models.PositiveIntegerField(
|
||||
help_text="Durée exprimée en mois entiers",
|
||||
blank=True,
|
||||
null=True,
|
||||
|
|
36
machines/migrations/0061_auto_20171015_2033.py
Normal file
36
machines/migrations/0061_auto_20171015_2033.py
Normal file
|
@ -0,0 +1,36 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.7 on 2017-10-15 18:33
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import django.core.validators
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('machines', '0060_iptype_ouverture_ports'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='mx',
|
||||
name='priority',
|
||||
field=models.PositiveIntegerField(unique=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='ouvertureport',
|
||||
name='begin',
|
||||
field=models.PositiveIntegerField(validators=[django.core.validators.MaxValueValidator(65535)]),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='ouvertureport',
|
||||
name='end',
|
||||
field=models.PositiveIntegerField(validators=[django.core.validators.MaxValueValidator(65535)]),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='vlan',
|
||||
name='vlan_id',
|
||||
field=models.PositiveIntegerField(validators=[django.core.validators.MaxValueValidator(4095)]),
|
||||
),
|
||||
]
|
|
@ -151,10 +151,11 @@ class IpType(models.Model):
|
|||
return self.type
|
||||
|
||||
class Vlan(models.Model):
|
||||
""" Un vlan : vlan_id et nom"""
|
||||
""" Un vlan : vlan_id et nom
|
||||
On limite le vlan id entre 0 et 4096, comme défini par la norme"""
|
||||
PRETTY_NAME = "Vlans"
|
||||
|
||||
vlan_id = models.IntegerField()
|
||||
vlan_id = models.PositiveIntegerField(validators=[MaxValueValidator(4095)])
|
||||
name = models.CharField(max_length=256)
|
||||
comment = models.CharField(max_length=256, blank=True)
|
||||
|
||||
|
@ -205,7 +206,7 @@ class Mx(models.Model):
|
|||
PRETTY_NAME = "Enregistrements MX"
|
||||
|
||||
zone = models.ForeignKey('Extension', on_delete=models.PROTECT)
|
||||
priority = models.IntegerField(unique=True)
|
||||
priority = models.PositiveIntegerField(unique=True)
|
||||
name = models.OneToOneField('Domain', on_delete=models.PROTECT)
|
||||
|
||||
@cached_property
|
||||
|
@ -512,13 +513,15 @@ class OuverturePort(models.Model):
|
|||
|
||||
Les ports de la plage sont compris entre begin et en inclus.
|
||||
Si begin == end alors on ne représente qu'un seul port.
|
||||
|
||||
On limite les ports entre 0 et 65535, tels que défini par la RFC
|
||||
"""
|
||||
TCP = 'T'
|
||||
UDP = 'U'
|
||||
IN = 'I'
|
||||
OUT = 'O'
|
||||
begin = models.IntegerField()
|
||||
end = models.IntegerField()
|
||||
begin = models.PositiveIntegerField(validators=[MaxValueValidator(65535)])
|
||||
end = models.PositiveIntegerField(validators=[MaxValueValidator(65535)])
|
||||
port_list = models.ForeignKey('OuverturePortList', on_delete=models.CASCADE)
|
||||
protocole = models.CharField(
|
||||
max_length=1,
|
||||
|
|
40
topologie/migrations/0031_auto_20171015_2033.py
Normal file
40
topologie/migrations/0031_auto_20171015_2033.py
Normal file
|
@ -0,0 +1,40 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.7 on 2017-10-15 18:33
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('topologie', '0030_auto_20171004_0235'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='port',
|
||||
name='port',
|
||||
field=models.PositiveIntegerField(),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='stack',
|
||||
name='member_id_max',
|
||||
field=models.PositiveIntegerField(),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='stack',
|
||||
name='member_id_min',
|
||||
field=models.PositiveIntegerField(),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='switch',
|
||||
name='number',
|
||||
field=models.PositiveIntegerField(),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='switch',
|
||||
name='stack_member_id',
|
||||
field=models.PositiveIntegerField(blank=True, null=True),
|
||||
),
|
||||
]
|
|
@ -52,8 +52,8 @@ class Stack(models.Model):
|
|||
name = models.CharField(max_length=32, blank=True, null=True)
|
||||
stack_id = models.CharField(max_length=32, unique=True)
|
||||
details = models.CharField(max_length=255, blank=True, null=True)
|
||||
member_id_min = models.IntegerField()
|
||||
member_id_max = models.IntegerField()
|
||||
member_id_min = models.PositiveIntegerField()
|
||||
member_id_max = models.PositiveIntegerField()
|
||||
|
||||
def __str__(self):
|
||||
return " ".join([self.name, self.stack_id])
|
||||
|
@ -90,7 +90,7 @@ class Switch(models.Model):
|
|||
on_delete=models.CASCADE
|
||||
)
|
||||
location = models.CharField(max_length=255)
|
||||
number = models.IntegerField()
|
||||
number = models.PositiveIntegerField()
|
||||
details = models.CharField(max_length=255, blank=True)
|
||||
stack = models.ForeignKey(
|
||||
Stack,
|
||||
|
@ -98,7 +98,7 @@ class Switch(models.Model):
|
|||
null=True,
|
||||
on_delete=models.SET_NULL
|
||||
)
|
||||
stack_member_id = models.IntegerField(blank=True, null=True)
|
||||
stack_member_id = models.PositiveIntegerField(blank=True, null=True)
|
||||
|
||||
class Meta:
|
||||
unique_together = ('stack', 'stack_member_id')
|
||||
|
@ -146,7 +146,7 @@ class Port(models.Model):
|
|||
)
|
||||
|
||||
switch = models.ForeignKey('Switch', related_name="ports")
|
||||
port = models.IntegerField()
|
||||
port = models.PositiveIntegerField()
|
||||
room = models.ForeignKey(
|
||||
'Room',
|
||||
on_delete=models.PROTECT,
|
||||
|
|
37
users/migrations/0056_auto_20171015_2033.py
Normal file
37
users/migrations/0056_auto_20171015_2033.py
Normal file
|
@ -0,0 +1,37 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.10.7 on 2017-10-15 18:33
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import django.core.validators
|
||||
from django.db import migrations, models
|
||||
import users.models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('users', '0055_auto_20171003_0556'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='listright',
|
||||
name='gid',
|
||||
field=models.PositiveIntegerField(null=True, unique=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='listright',
|
||||
name='listright',
|
||||
field=models.CharField(max_length=255, unique=True, validators=[django.core.validators.RegexValidator('^[a-z]+$', message='Les groupes unix ne peuvent contenir que des lettres minuscules')]),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='user',
|
||||
name='rezo_rez_uid',
|
||||
field=models.PositiveIntegerField(blank=True, null=True, unique=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='user',
|
||||
name='uid_number',
|
||||
field=models.PositiveIntegerField(default=users.models.User.auto_uid, unique=True),
|
||||
),
|
||||
]
|
|
@ -243,8 +243,8 @@ class User(AbstractBaseUser):
|
|||
state = models.IntegerField(choices=STATES, default=STATE_ACTIVE)
|
||||
registered = models.DateTimeField(auto_now_add=True)
|
||||
telephone = models.CharField(max_length=15, blank=True, null=True)
|
||||
uid_number = models.IntegerField(default=auto_uid, unique=True)
|
||||
rezo_rez_uid = models.IntegerField(unique=True, blank=True, null=True)
|
||||
uid_number = models.PositiveIntegerField(default=auto_uid, unique=True)
|
||||
rezo_rez_uid = models.PositiveIntegerField(unique=True, blank=True, null=True)
|
||||
|
||||
USERNAME_FIELD = 'pseudo'
|
||||
REQUIRED_FIELDS = ['name', 'surname', 'email']
|
||||
|
@ -840,7 +840,7 @@ class ListRight(models.Model):
|
|||
que des lettres minuscules"
|
||||
)]
|
||||
)
|
||||
gid = models.IntegerField(unique=True, null=True)
|
||||
gid = models.PositiveIntegerField(unique=True, null=True)
|
||||
details = models.CharField(
|
||||
help_text="Description",
|
||||
max_length=255,
|
||||
|
|
Loading…
Reference in a new issue