We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 268850e commit b4c4debCopy full SHA for b4c4deb
deals/views.py
@@ -78,7 +78,9 @@ def get_filter_form(self):
78
# Copy GET params and set defaults for missing fields
79
data = self.request.GET.copy()
80
if 'status_filter' not in data:
81
- data['status_filter'] = 'active'
+ # Default to 'all' if there are no active deals, otherwise 'active'
82
+ has_active_deals = Deal.objects.filter(expires__gt=timezone.now()).exists()
83
+ data['status_filter'] = 'active' if has_active_deals else 'all'
84
if 'sort' not in data:
85
data['sort'] = 'newest'
86
0 commit comments