0001-manager-sort-groups-in-page-visibility-form-34818.patch
combo/manager/forms.py | ||
---|---|---|
26 | 26 |
from .fields import ImageIncludingSvgField |
27 | 27 | |
28 | 28 | |
29 |
def get_groups_as_choices(): |
|
30 |
return [(x.id, x.name) for x in Group.objects.all().order_by('name')] |
|
31 | ||
32 | ||
29 | 33 |
class PageEditTitleForm(forms.ModelForm): |
30 | 34 |
class Meta: |
31 | 35 |
model = Page |
... | ... | |
61 | 65 | |
62 | 66 | |
63 | 67 |
class PageVisibilityForm(forms.ModelForm): |
68 |
groups = forms.MultipleChoiceField( |
|
69 |
label=_('Groups'), |
|
70 |
required=False, |
|
71 |
choices=get_groups_as_choices) |
|
72 | ||
64 | 73 |
class Meta: |
65 | 74 |
model = Page |
66 | 75 |
fields = ('public', 'groups') |
... | ... | |
105 | 114 |
fields = ('exclude_from_navigation',) |
106 | 115 | |
107 | 116 | |
108 |
def get_groups_as_choices(): |
|
109 |
return [(x.id, x.name) for x in Group.objects.all().order_by('name')] |
|
110 | ||
111 | ||
112 | 117 |
class CellVisibilityForm(forms.Form): |
113 | 118 |
visibility = forms.ChoiceField( |
114 | 119 |
label=_('Visibility'), |
115 |
- |