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())
|
course = forms.ModelChoiceField(queryset=GeoCourse.objects.all())
|
||||||
|
|
||||||
class WorkoutMultipleCompareForm(forms.Form):
|
class WorkoutMultipleCompareForm(forms.Form):
|
||||||
workouts = forms.ModelMultipleChoiceField(queryset=Workout.objects.all(),
|
workouts = forms.ModelMultipleChoiceField(
|
||||||
|
queryset=Workout.objects.filter(),
|
||||||
widget=forms.CheckboxSelectMultiple())
|
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):
|
class PlannedSessionMultipleCloneForm(forms.Form):
|
||||||
plannedsessions = forms.ModelMultipleChoiceField(
|
plannedsessions = forms.ModelMultipleChoiceField(
|
||||||
queryset=PlannedSession.objects.all(),
|
queryset=PlannedSession.objects.all(),
|
||||||
|
|||||||
@@ -5405,7 +5405,7 @@ def team_comparison_select(request,
|
|||||||
workouttype__in=modalities).order_by("-date", "-starttime").exclude(boattype__in=negtypes)
|
workouttype__in=modalities).order_by("-date", "-starttime").exclude(boattype__in=negtypes)
|
||||||
|
|
||||||
if rankingonly:
|
if rankingonly:
|
||||||
workouts = [w for w in workouts if w.rankingpiece]
|
workouts = workouts.exclude(rankingpiece=False)
|
||||||
|
|
||||||
query = request.GET.get('q')
|
query = request.GET.get('q')
|
||||||
if query:
|
if query:
|
||||||
@@ -6361,7 +6361,7 @@ def user_boxplot_select(request,
|
|||||||
# workouttypes = [w for w in workouttypes if w not in mytypes.otwtypes]
|
# workouttypes = [w for w in workouttypes if w not in mytypes.otwtypes]
|
||||||
|
|
||||||
if rankingonly:
|
if rankingonly:
|
||||||
workouts = [w for w in workouts if w.rankingpiece]
|
workouts = workouts.exclude(rankingpiece=False)
|
||||||
|
|
||||||
query = request.GET.get('q')
|
query = request.GET.get('q')
|
||||||
if query:
|
if query:
|
||||||
@@ -6775,7 +6775,8 @@ def workouts_view(request,message='',successmessage='',
|
|||||||
startdatetime__lte=activity_enddate).order_by("-startdatetime")
|
startdatetime__lte=activity_enddate).order_by("-startdatetime")
|
||||||
|
|
||||||
if rankingonly:
|
if rankingonly:
|
||||||
workouts = [w for w in workouts if w.rankingpiece]
|
workouts = workouts.exclude(rankingpiece=False)
|
||||||
|
|
||||||
|
|
||||||
query = request.GET.get('q')
|
query = request.GET.get('q')
|
||||||
if query:
|
if query:
|
||||||
|
|||||||
Reference in New Issue
Block a user