Loading hardware_provisioning/models.py +13 −0 Original line number Diff line number Diff line # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.core.exceptions import ValidationError from django.db import models from django.db.models import Q from django.conf import settings Loading Loading @@ -172,6 +173,18 @@ class Loan(models.Model): is_running.boolean = True is_running.short_description = 'En cours ?' def clean(self): current_loan = self.item.get_current_loan() if ( self.is_running() and current_loan and self.item.get_current_loan() != self ): raise ValidationError( "Il y a déjà un emprunt en cours sur cet objet") class Meta: verbose_name = 'prêt d’objet' verbose_name_plural = 'prêts d’objets' Loading Loading
hardware_provisioning/models.py +13 −0 Original line number Diff line number Diff line # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.core.exceptions import ValidationError from django.db import models from django.db.models import Q from django.conf import settings Loading Loading @@ -172,6 +173,18 @@ class Loan(models.Model): is_running.boolean = True is_running.short_description = 'En cours ?' def clean(self): current_loan = self.item.get_current_loan() if ( self.is_running() and current_loan and self.item.get_current_loan() != self ): raise ValidationError( "Il y a déjà un emprunt en cours sur cet objet") class Meta: verbose_name = 'prêt d’objet' verbose_name_plural = 'prêts d’objets' Loading