sorting choice fields
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user