mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-07-01 14:01:19 +02:00
Add survey feature
This commit is contained in:
28
survey/forms.py
Normal file
28
survey/forms.py
Normal file
@ -0,0 +1,28 @@
|
||||
from django import forms
|
||||
|
||||
from .models import Survey
|
||||
|
||||
|
||||
class SurveyForm(forms.ModelForm):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
if 'survey_id' in self.initial:
|
||||
self.fields['survey_id'].disabled = True
|
||||
|
||||
class Meta:
|
||||
model = Survey
|
||||
exclude = ('completed_registrations', 'completed_teams',)
|
||||
widgets = {
|
||||
'completed_registrations': forms.SelectMultiple(attrs={
|
||||
'class': 'selectpicker',
|
||||
'data-live-search': 'true',
|
||||
'data-live-search-normalize': 'true',
|
||||
'data-width': 'fit',
|
||||
}),
|
||||
'completed_teams': forms.SelectMultiple(attrs={
|
||||
'class': 'selectpicker',
|
||||
'data-live-search': 'true',
|
||||
'data-live-search-normalize': 'true',
|
||||
'data-width': 'fit',
|
||||
}),
|
||||
}
|
Reference in New Issue
Block a user