sorting choice fields

This commit is contained in:
2020-12-11 00:38:42 +00:00
parent 768f2fd2a9
commit 74b1beda92
3 changed files with 14 additions and 6 deletions

View File

@@ -59,6 +59,7 @@ class NewsForm(PostForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) # to get the self.fields set
self.fields['author'].queryset = self.fields['author'].queryset.order_by('username')
class EventForm(PostForm):
@@ -98,6 +99,7 @@ class EventForm(PostForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) # to get the self.fields set
self.fields['author'].queryset = self.fields['author'].queryset.order_by('username')
self.fields['event_start'].required = True
self.fields['event_end'].required = True
@@ -129,6 +131,7 @@ class FetMeetingForm(EventForm):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) # to get the self.fields set
self.fields['author'].queryset = self.fields['author'].queryset.order_by('username')
self.fields['event_start'].required = True
self.fields['event_end'].required = False