1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| class EventAddInvitGroupForm(forms.Form):
id_unique = forms.CharField(widget=forms.HiddenInput())
Slug = forms.CharField(widget=forms.HiddenInput())
DateConvoc = forms.DateTimeField(label ='Date et heure', widget=forms.DateTimeInput(), required = False)
Contenu = forms.CharField(label = 'Message', widget=forms.TextInput(attrs={'size':'40'}), help_text = "Commentaire, 255 caractères max", required = False)
Invitation = forms.BooleanField(label = 'Invitation', required = False)
Scene = forms.ModelChoiceField(queryset = scene.objects.none(), label = 'Scène', required = False)
def __init__(self, event = None, *args, **kwargs):
super(EventAddInvitGroupForm, self).__init__(*args, **kwargs)
self.event = event
self.evente = evenement.objects.get(id = self.event)
if self.event != None:
self.lieu = Lieux.objects.filter(id = self.evente.Lieu.id)
self.fields['Scene'].queryset = scene.objects.all()
else:
self.fields['Scene'].queryset = scene.objects.all() |
Partager