From efcc0a4f7c9b5107231b8cd8248e6d6d9552bf2d Mon Sep 17 00:00:00 2001 From: Gabriel Detraz Date: Mon, 6 Mar 2017 02:28:16 +0100 Subject: [PATCH] Ajoute des niveaux de ban --- users/migrations/0043_ban_state.py | 19 +++++++++++++++++++ users/models.py | 10 ++++++++++ 2 files changed, 29 insertions(+) create mode 100644 users/migrations/0043_ban_state.py diff --git a/users/migrations/0043_ban_state.py b/users/migrations/0043_ban_state.py new file mode 100644 index 00000000..897415e4 --- /dev/null +++ b/users/migrations/0043_ban_state.py @@ -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), + ), + ] diff --git a/users/models.py b/users/models.py index eaa48d05..5069ac30 100644 --- a/users/models.py +++ b/users/models.py @@ -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)