mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2024-12-25 05:42:23 +00:00
Use bootstrap-select selector when it is necessary
This commit is contained in:
parent
e156ed6111
commit
a8f24b6581
@ -120,31 +120,28 @@ class ValidateParticipationForm(forms.Form):
|
|||||||
|
|
||||||
|
|
||||||
class TournamentForm(forms.ModelForm):
|
class TournamentForm(forms.ModelForm):
|
||||||
def __init__(self, *args, **kwargs):
|
|
||||||
super().__init__(*args, **kwargs)
|
|
||||||
|
|
||||||
self.fields["date_start"].widget = forms.DateInput(attrs={'type': 'date'}, format='%Y-%m-%d')
|
|
||||||
self.fields["date_end"].widget = forms.DateInput(attrs={'type': 'date'}, format='%Y-%m-%d')
|
|
||||||
self.fields["inscription_limit"].widget = forms.DateTimeInput(attrs={'type': 'datetime-local'},
|
|
||||||
format='%Y-%m-%d %H:%M')
|
|
||||||
self.fields["solution_limit"].widget = forms.DateTimeInput(attrs={'type': 'datetime-local'},
|
|
||||||
format='%Y-%m-%d %H:%M')
|
|
||||||
self.fields["solutions_draw"].widget = forms.DateTimeInput(attrs={'type': 'datetime-local'},
|
|
||||||
format='%Y-%m-%d %H:%M')
|
|
||||||
self.fields["syntheses_first_phase_limit"].widget = forms.DateTimeInput(attrs={'type': 'datetime-local'},
|
|
||||||
format='%Y-%m-%d %H:%M')
|
|
||||||
self.fields["solutions_available_second_phase"].widget = forms.DateTimeInput(attrs={'type': 'datetime-local'},
|
|
||||||
format='%Y-%m-%d %H:%M')
|
|
||||||
self.fields["syntheses_second_phase_limit"].widget = forms.DateTimeInput(attrs={'type': 'datetime-local'},
|
|
||||||
format='%Y-%m-%d %H:%M')
|
|
||||||
self.fields["organizers"].widget.attrs['class'] = 'selectpicker'
|
|
||||||
self.fields["organizers"].widget.attrs['data-live-search'] = 'true'
|
|
||||||
self.fields["organizers"].widget.attrs['data-live-search-normalize'] = 'true'
|
|
||||||
self.fields["organizers"].queryset = VolunteerRegistration.objects.all()
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Tournament
|
model = Tournament
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
widgets = {
|
||||||
|
'date_start': forms.DateInput(attrs={'type': 'date'}, format='%Y-%m-%d'),
|
||||||
|
'date_end': forms.DateInput(attrs={'type': 'date'}, format='%Y-%m-%d'),
|
||||||
|
'inscription_limit': forms.DateTimeInput(attrs={'type': 'datetime-local'}, format='%Y-%m-%d %H:%M'),
|
||||||
|
'solution_limit': forms.DateTimeInput(attrs={'type': 'datetime-local'}, format='%Y-%m-%d %H:%M'),
|
||||||
|
'solutions_draw': forms.DateTimeInput(attrs={'type': 'datetime-local'}, format='%Y-%m-%d %H:%M'),
|
||||||
|
'syntheses_first_phase_limit': forms.DateTimeInput(attrs={'type': 'datetime-local'},
|
||||||
|
format='%Y-%m-%d %H:%M'),
|
||||||
|
'solutions_available_second_phase': forms.DateTimeInput(attrs={'type': 'datetime-local'},
|
||||||
|
format='%Y-%m-%d %H:%M'),
|
||||||
|
'syntheses_second_phase_limit': forms.DateTimeInput(attrs={'type': 'datetime-local'},
|
||||||
|
format='%Y-%m-%d %H:%M'),
|
||||||
|
'organizers': forms.SelectMultiple(attrs={
|
||||||
|
'class': 'selectpicker',
|
||||||
|
'data-live-search': 'true',
|
||||||
|
'data-live-search-normalize': 'true',
|
||||||
|
'data-width': 'fit',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class SolutionForm(forms.ModelForm):
|
class SolutionForm(forms.ModelForm):
|
||||||
@ -176,7 +173,11 @@ class PoolForm(forms.ModelForm):
|
|||||||
model = Pool
|
model = Pool
|
||||||
fields = ('tournament', 'round', 'bbb_url', 'results_available', 'juries',)
|
fields = ('tournament', 'round', 'bbb_url', 'results_available', 'juries',)
|
||||||
widgets = {
|
widgets = {
|
||||||
"juries": forms.CheckboxSelectMultiple,
|
"juries": forms.SelectMultiple(attrs={
|
||||||
|
'class': 'selectpicker',
|
||||||
|
'data-live-search': 'true',
|
||||||
|
'data-live-search-normalize': 'true',
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -189,7 +190,12 @@ class PoolTeamsForm(forms.ModelForm):
|
|||||||
model = Pool
|
model = Pool
|
||||||
fields = ('participations',)
|
fields = ('participations',)
|
||||||
widgets = {
|
widgets = {
|
||||||
"participations": forms.CheckboxSelectMultiple,
|
"participations": forms.SelectMultiple(attrs={
|
||||||
|
'class': 'selectpicker',
|
||||||
|
'data-live-search': 'true',
|
||||||
|
'data-live-search-normalize': 'true',
|
||||||
|
'data-width': 'fit',
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
{% if user_object == user %}
|
{% if user_object == user %}
|
||||||
<dt class="col-sm-6 text-end">{% trans "Password:" %}</dt>
|
<dt class="col-sm-6 text-end">{% trans "Password:" %}</dt>
|
||||||
<dd class="col-sm-6">
|
<dd class="col-sm-6">
|
||||||
<a href="{% url 'password_change' %}" class="btn-sm btn-secondary">
|
<a href="{% url 'password_change' %}" class="btn btn-sm btn-secondary">
|
||||||
<i class="fas fa-edit"></i> {% trans "Change password" %}
|
<i class="fas fa-edit"></i> {% trans "Change password" %}
|
||||||
</a>
|
</a>
|
||||||
</dd>
|
</dd>
|
||||||
|
@ -229,9 +229,6 @@ PHONENUMBER_DEFAULT_REGION = 'FR'
|
|||||||
|
|
||||||
GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
|
GOOGLE_API_KEY = os.getenv("GOOGLE_API_KEY")
|
||||||
|
|
||||||
# Use local Jquery
|
|
||||||
JQUERY_URL = False
|
|
||||||
|
|
||||||
# Custom parameters
|
# Custom parameters
|
||||||
PROBLEM_COUNT = 8
|
PROBLEM_COUNT = 8
|
||||||
FORBIDDEN_TRIGRAMS = [
|
FORBIDDEN_TRIGRAMS = [
|
||||||
|
@ -263,6 +263,7 @@
|
|||||||
.then(resp => resp.text())
|
.then(resp => resp.text())
|
||||||
.then(resp => new DOMParser().parseFromString(resp, 'text/html'))
|
.then(resp => new DOMParser().parseFromString(resp, 'text/html'))
|
||||||
.then(res => modalBody.innerHTML = res.getElementById(content_id).outerHTML)
|
.then(res => modalBody.innerHTML = res.getElementById(content_id).outerHTML)
|
||||||
|
.then(() => $('.selectpicker').selectpicker()) // TODO Update that when the library will be JQuery-free
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user