diff --git a/equipment/fields.py b/equipment/fields.py index db5546f..2b63d52 100644 --- a/equipment/fields.py +++ b/equipment/fields.py @@ -60,6 +60,7 @@ class IdField(models.BigIntegerField): def __init__(self, separator=",", *args, **kwargs): self.separator = separator super(IdField, self).__init__(*args, **kwargs) + self.validators = [] # TODO : validateurs pertinents def deconstruct(self): name, path, args, kwargs = super(IdField, self).deconstruct() diff --git a/equipment/migrations/0001_initial.py b/equipment/migrations/0001_initial.py index c985556..95329c2 100644 --- a/equipment/migrations/0001_initial.py +++ b/equipment/migrations/0001_initial.py @@ -5,6 +5,7 @@ from __future__ import unicode_literals import datetime from django.db import migrations, models import django.db.models.deletion +import equipment.fields class Migration(migrations.Migration): @@ -81,7 +82,7 @@ class Migration(migrations.Migration): fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('remark', models.TextField(verbose_name='remarque sur le matériel')), - ('ide', models.PositiveSmallIntegerField(verbose_name='id')), + ('ids', equipment.fields.IdField()), ('is_broken', models.BooleanField()), ('is_lost', models.BooleanField()), ('equipment', models.ForeignKey(help_text='Matériel concerné par la remarque', on_delete=django.db.models.deletion.CASCADE, related_name='remarks', to='equipment.Equipment')), @@ -97,7 +98,7 @@ class Migration(migrations.Migration): ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('date', models.DateField(default=datetime.date.today, verbose_name='date')), ('remark', models.TextField(verbose_name='remarque sur la révision')), - ('ide', models.PositiveSmallIntegerField(verbose_name='id')), + ('ids', equipment.fields.IdField()), ('equipment', models.ForeignKey(help_text='Matériel concerné par les révisions', on_delete=django.db.models.deletion.CASCADE, related_name='revisions', to='equipment.Equipment')), ], options={ diff --git a/equipment/models.py b/equipment/models.py index 93f4063..37b296b 100644 --- a/equipment/models.py +++ b/equipment/models.py @@ -112,7 +112,7 @@ class EquipmentRemark(models.Model): related_name="remarks", help_text=_("Matériel concerné par la remarque"), ) - ide = models.PositiveSmallIntegerField(_("id")) + ids = IdField() is_broken = models.BooleanField() is_lost = models.BooleanField() @@ -136,7 +136,7 @@ class EquipmentRevision(models.Model): help_text=_("Matériel concerné par les révisions"), ) remark = models.TextField(_("remarque sur la révision")) - ide = models.PositiveSmallIntegerField(_("id")) + ids = IdField() class Meta: verbose_name = _("révision de matériel")