mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-04-01 18:51:11 +00:00
29 lines
914 B
Python
29 lines
914 B
Python
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',
|
|
}),
|
|
}
|