mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-12-23 23:43:47 +00:00
Ajoute des niveaux de ban
This commit is contained in:
parent
d83eb7dfe9
commit
efcc0a4f7c
2 changed files with 29 additions and 0 deletions
19
users/migrations/0043_ban_state.py
Normal file
19
users/migrations/0043_ban_state.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('users', '0042_auto_20161126_2028'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='ban',
|
||||
name='state',
|
||||
field=models.IntegerField(choices=[(0, 'STATE_HARD'), (1, 'STATE_SOFT'), (2, 'STATE_BRIDAGE')], default=0),
|
||||
),
|
||||
]
|
|
@ -430,10 +430,20 @@ class ListShell(models.Model):
|
|||
class Ban(models.Model):
|
||||
PRETTY_NAME = "Liste des bannissements"
|
||||
|
||||
STATE_HARD = 0
|
||||
STATE_SOFT = 1
|
||||
STATE_BRIDAGE = 2
|
||||
STATES = (
|
||||
(0, 'HARD (aucun accès)'),
|
||||
(1, 'SOFT (accès local seulement)'),
|
||||
(2, 'BRIDAGE (bridage du débit)'),
|
||||
)
|
||||
|
||||
user = models.ForeignKey('User', on_delete=models.PROTECT)
|
||||
raison = models.CharField(max_length=255)
|
||||
date_start = models.DateTimeField(auto_now_add=True)
|
||||
date_end = models.DateTimeField(help_text='%d/%m/%y %H:%M:%S')
|
||||
state = models.IntegerField(choices=STATES, default=STATE_HARD)
|
||||
|
||||
def __str__(self):
|
||||
return str(self.user) + ' ' + str(self.raison)
|
||||
|
|
Loading…
Reference in a new issue