Fix IdField validation

This commit is contained in:
Evarin 2018-08-06 18:34:07 +02:00
parent 7ab4dcede0
commit 747d3419b2
3 changed files with 6 additions and 4 deletions

View file

@ -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()

View file

@ -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={

View file

@ -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")