mirror of
				https://gitlab.crans.org/mediatek/med.git
				synced 2025-11-04 16:02:29 +01:00 
			
		
		
		
	Fix durée d'un jeu
This commit is contained in:
		@@ -39,6 +39,11 @@ class JeuForm(ModelForm):
 | 
			
		||||
        model = Jeu
 | 
			
		||||
        fields = '__all__'
 | 
			
		||||
 | 
			
		||||
    def clean_nombre_joueurs_max(self):
 | 
			
		||||
        if self.cleaned_data['nombre_joueurs_max'] < self.cleaned_data['nombre_joueurs_min']:
 | 
			
		||||
            raise forms.ValidationError("Max ne peut être inférieur à min")
 | 
			
		||||
        return self.cleaned_data['nombre_joueurs_max']
 | 
			
		||||
 | 
			
		||||
class EmpruntForm(ModelForm):
 | 
			
		||||
    class Meta:
 | 
			
		||||
        model = Emprunt
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										31
									
								
								media/migrations/0007_auto_20170704_0138.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								media/migrations/0007_auto_20170704_0138.py
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,31 @@
 | 
			
		||||
# -*- coding: utf-8 -*-
 | 
			
		||||
# Generated by Django 1.11.2 on 2017-07-03 23:38
 | 
			
		||||
from __future__ import unicode_literals
 | 
			
		||||
 | 
			
		||||
import django.core.validators
 | 
			
		||||
from django.db import migrations, models
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Migration(migrations.Migration):
 | 
			
		||||
 | 
			
		||||
    dependencies = [
 | 
			
		||||
        ('media', '0006_jeu'),
 | 
			
		||||
    ]
 | 
			
		||||
 | 
			
		||||
    operations = [
 | 
			
		||||
        migrations.AlterField(
 | 
			
		||||
            model_name='jeu',
 | 
			
		||||
            name='duree',
 | 
			
		||||
            field=models.CharField(choices=[('1h-', '1h-'), ('1-2h', '1-2h'), ('2-3h', '2-3h'), ('4h+', '4h+')], max_length=255),
 | 
			
		||||
        ),
 | 
			
		||||
        migrations.AlterField(
 | 
			
		||||
            model_name='jeu',
 | 
			
		||||
            name='nombre_joueurs_max',
 | 
			
		||||
            field=models.IntegerField(validators=[django.core.validators.MinValueValidator(1)]),
 | 
			
		||||
        ),
 | 
			
		||||
        migrations.AlterField(
 | 
			
		||||
            model_name='jeu',
 | 
			
		||||
            name='nombre_joueurs_min',
 | 
			
		||||
            field=models.IntegerField(validators=[django.core.validators.MinValueValidator(1)]),
 | 
			
		||||
        ),
 | 
			
		||||
    ]
 | 
			
		||||
@@ -1,4 +1,5 @@
 | 
			
		||||
from django.db import models
 | 
			
		||||
from django.core.validators import MinValueValidator
 | 
			
		||||
 | 
			
		||||
class Auteur(models.Model):
 | 
			
		||||
    nom = models.CharField(max_length=255)
 | 
			
		||||
@@ -26,17 +27,18 @@ class Emprunt(models.Model):
 | 
			
		||||
 | 
			
		||||
class Jeu(models.Model):
 | 
			
		||||
    DUREE = (
 | 
			
		||||
            ('LONG', 'LONG'),
 | 
			
		||||
            ('MOYEN', 'MOYEN'),
 | 
			
		||||
            ('COURT', 'COURT'),
 | 
			
		||||
            ('-1h', '-1h'),
 | 
			
		||||
            ('1-2h', '1-2h'),
 | 
			
		||||
            ('2-3h', '2-3h'),
 | 
			
		||||
            ('4h+', '4h+'),
 | 
			
		||||
            )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    nom = models.CharField(max_length=255)
 | 
			
		||||
    proprietaire = models.ForeignKey('users.User', on_delete=models.PROTECT) 
 | 
			
		||||
    duree = models.CharField(choices=DUREE, max_length=255)
 | 
			
		||||
    nombre_joueurs_min = models.IntegerField()
 | 
			
		||||
    nombre_joueurs_max = models.IntegerField()
 | 
			
		||||
    nombre_joueurs_min = models.IntegerField(validators=[MinValueValidator(1)])
 | 
			
		||||
    nombre_joueurs_max = models.IntegerField(validators=[MinValueValidator(1)])
 | 
			
		||||
    comment = models.CharField(help_text="Commentaire", max_length=255, blank=True, null=True)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user