Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mediatek
Base de données Mediatek
Commits
3c9021f8
Commit
3c9021f8
authored
Jul 04, 2017
by
Med
Browse files
Fix durée d'un jeu
parent
dee26e3e
Changes
3
Hide whitespace changes
Inline
Side-by-side
media/forms.py
View file @
3c9021f8
...
...
@@ -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
...
...
media/migrations/0007_auto_20170704_0138.py
0 → 100644
View file @
3c9021f8
# -*- 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
)]),
),
]
media/models.py
View file @
3c9021f8
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
)
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment