-
Notifications
You must be signed in to change notification settings - Fork 0
/
forms.py
43 lines (29 loc) · 1.39 KB
/
forms.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
from django import forms
from .models import Enquete,Interception,Joueur,Copie
class EnqueteForm(forms.ModelForm):
pointsChoices= ( (x,str(x)) for x in range(1,7))
points = forms.ChoiceField(label = "Nombre de points pariés (y compris le 1er point de l'enquete)", choices = pointsChoices);
diceChoices= ( (x,str(x)) for x in range(1,7))
dice = forms.ChoiceField(label = "Resultat du dé", choices = diceChoices);
class Meta:
model = Enquete
fields = ( 'joueur', 'piste')
class CategoryChoiceField(forms.ModelChoiceField):
def label_from_instance(self, obj):
return "Category: {}".format(obj.name)
class InterceptionForm(forms.ModelForm):
field_order = [ 'type', 'origin', 'target', 'points' ]
targetChoices= ( (x.id,x.character_name) for x in Joueur.objects.all())
target = forms.ChoiceField(label = "Joueur cible", choices = targetChoices)
diceChoices= ( (x,str(x)) for x in range(1,7))
dice = forms.ChoiceField(label = "Resultat du dé", choices = diceChoices);
class Meta:
model = Interception
fields = ( 'origin', )
class CopieForm(forms.ModelForm):
field_order = ['origin','target']
targetChoices= ( (x.id,x.character_name) for x in Joueur.objects.all())
target = forms.ChoiceField(label = "Joueur cible", choices = targetChoices)
class Meta:
model = Copie
fields = ( 'origin', )