mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-21 21:53:30 +00:00
Better ui for group selection on election and wiki
This commit is contained in:
parent
c8fae39ff0
commit
d49f7858d3
@ -2,8 +2,7 @@
|
|||||||
#
|
#
|
||||||
# Copyright 2016,2017
|
# Copyright 2016,2017
|
||||||
# - Skia <skia@libskia.so>
|
# - Skia <skia@libskia.so>
|
||||||
# - Sli <antoine@bartuccio.fr>
|
# - Sli <antoine@bartuccio.fr> #
|
||||||
#
|
|
||||||
# Ce fichier fait partie du site de l'Association des Étudiants de l'UTBM,
|
# Ce fichier fait partie du site de l'Association des Étudiants de l'UTBM,
|
||||||
# http://ae.utbm.fr.
|
# http://ae.utbm.fr.
|
||||||
#
|
#
|
||||||
@ -33,6 +32,7 @@ from django.utils.translation import ugettext_lazy as _
|
|||||||
from django.utils.translation import ugettext
|
from django.utils.translation import ugettext
|
||||||
from phonenumber_field.widgets import PhoneNumberInternationalFallbackWidget
|
from phonenumber_field.widgets import PhoneNumberInternationalFallbackWidget
|
||||||
from ajax_select.fields import AutoCompleteSelectField
|
from ajax_select.fields import AutoCompleteSelectField
|
||||||
|
from ajax_select import make_ajax_field
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
@ -261,10 +261,8 @@ class PagePropForm(forms.ModelForm):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = Page
|
model = Page
|
||||||
fields = ['parent', 'name', 'owner_group', 'edit_groups', 'view_groups', ]
|
fields = ['parent', 'name', 'owner_group', 'edit_groups', 'view_groups', ]
|
||||||
widgets = {
|
edit_groups = make_ajax_field(Page, 'edit_groups', 'groups', help_text="", label=_("edit groups"))
|
||||||
'edit_groups': CheckboxSelectMultiple,
|
view_groups = make_ajax_field(Page, 'view_groups', 'groups', help_text="", label=_("view groups"))
|
||||||
'view_groups': CheckboxSelectMultiple,
|
|
||||||
}
|
|
||||||
|
|
||||||
def __init__(self, *arg, **kwargs):
|
def __init__(self, *arg, **kwargs):
|
||||||
super(PagePropForm, self).__init__(*arg, **kwargs)
|
super(PagePropForm, self).__init__(*arg, **kwargs)
|
||||||
@ -276,10 +274,8 @@ class PageForm(forms.ModelForm):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = Page
|
model = Page
|
||||||
fields = ['parent', 'name', 'owner_group', 'edit_groups', 'view_groups']
|
fields = ['parent', 'name', 'owner_group', 'edit_groups', 'view_groups']
|
||||||
widgets = {
|
edit_groups = make_ajax_field(Page, 'edit_groups', 'groups', help_text="", label=_("edit groups"))
|
||||||
'edit_groups': CheckboxSelectMultiple,
|
view_groups = make_ajax_field(Page, 'view_groups', 'groups', help_text="", label=_("view groups"))
|
||||||
'view_groups': CheckboxSelectMultiple,
|
|
||||||
}
|
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super(PageForm, self).__init__(*args, **kwargs)
|
super(PageForm, self).__init__(*args, **kwargs)
|
||||||
|
@ -16,6 +16,7 @@ from core.views.forms import SelectDateTime
|
|||||||
from election.models import Election, Role, Candidature, ElectionList, Vote
|
from election.models import Election, Role, Candidature, ElectionList, Vote
|
||||||
|
|
||||||
from ajax_select.fields import AutoCompleteSelectField
|
from ajax_select.fields import AutoCompleteSelectField
|
||||||
|
from ajax_select import make_ajax_field
|
||||||
|
|
||||||
|
|
||||||
# Custom form field
|
# Custom form field
|
||||||
@ -123,13 +124,11 @@ class ElectionForm(forms.ModelForm):
|
|||||||
'start_date', 'end_date',
|
'start_date', 'end_date',
|
||||||
'edit_groups', 'view_groups',
|
'edit_groups', 'view_groups',
|
||||||
'vote_groups', 'candidature_groups']
|
'vote_groups', 'candidature_groups']
|
||||||
widgets = {
|
|
||||||
'edit_groups': CheckboxSelectMultiple,
|
edit_groups = make_ajax_field(Election, 'edit_groups', 'groups', help_text="", label=_("edit groups"))
|
||||||
'view_groups': CheckboxSelectMultiple,
|
view_groups = make_ajax_field(Election, 'view_groups', 'groups', help_text="", label=_("view groups"))
|
||||||
'edit_groups': CheckboxSelectMultiple,
|
vote_groups = make_ajax_field(Election, 'vote_groups', 'groups', help_text="", label=_("vote groups"))
|
||||||
'vote_groups': CheckboxSelectMultiple,
|
candidature_groups = make_ajax_field(Election, 'candidature_groups', 'groups', help_text="", label=_("candidature groups"))
|
||||||
'candidature_groups': CheckboxSelectMultiple
|
|
||||||
}
|
|
||||||
|
|
||||||
start_date = forms.DateTimeField(['%Y-%m-%d %H:%M:%S'], label=_("Start date"),
|
start_date = forms.DateTimeField(['%Y-%m-%d %H:%M:%S'], label=_("Start date"),
|
||||||
widget=SelectDateTime, required=True)
|
widget=SelectDateTime, required=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user