reducing queryset should be using exclude
This commit is contained in:
@@ -650,9 +650,15 @@ class CourseSelectForm(forms.Form):
|
||||
course = forms.ModelChoiceField(queryset=GeoCourse.objects.all())
|
||||
|
||||
class WorkoutMultipleCompareForm(forms.Form):
|
||||
workouts = forms.ModelMultipleChoiceField(queryset=Workout.objects.all(),
|
||||
widget=forms.CheckboxSelectMultiple())
|
||||
workouts = forms.ModelMultipleChoiceField(
|
||||
queryset=Workout.objects.filter(),
|
||||
widget=forms.CheckboxSelectMultiple())
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(WorkoutMultipleCompareForm,self).__init__(*args,**kwargs)
|
||||
self.fields['workouts'].queryset = Workout.objects.filter()
|
||||
|
||||
|
||||
class PlannedSessionMultipleCloneForm(forms.Form):
|
||||
plannedsessions = forms.ModelMultipleChoiceField(
|
||||
queryset=PlannedSession.objects.all(),
|
||||
|
||||
@@ -5405,7 +5405,7 @@ def team_comparison_select(request,
|
||||
workouttype__in=modalities).order_by("-date", "-starttime").exclude(boattype__in=negtypes)
|
||||
|
||||
if rankingonly:
|
||||
workouts = [w for w in workouts if w.rankingpiece]
|
||||
workouts = workouts.exclude(rankingpiece=False)
|
||||
|
||||
query = request.GET.get('q')
|
||||
if query:
|
||||
@@ -6361,7 +6361,7 @@ def user_boxplot_select(request,
|
||||
# workouttypes = [w for w in workouttypes if w not in mytypes.otwtypes]
|
||||
|
||||
if rankingonly:
|
||||
workouts = [w for w in workouts if w.rankingpiece]
|
||||
workouts = workouts.exclude(rankingpiece=False)
|
||||
|
||||
query = request.GET.get('q')
|
||||
if query:
|
||||
@@ -6775,7 +6775,8 @@ def workouts_view(request,message='',successmessage='',
|
||||
startdatetime__lte=activity_enddate).order_by("-startdatetime")
|
||||
|
||||
if rankingonly:
|
||||
workouts = [w for w in workouts if w.rankingpiece]
|
||||
workouts = workouts.exclude(rankingpiece=False)
|
||||
|
||||
|
||||
query = request.GET.get('q')
|
||||
if query:
|
||||
|
||||
Reference in New Issue
Block a user