From 6ce976e63a9b437da5b6427fc3481485aab95fb6 Mon Sep 17 00:00:00 2001 From: Ben Sturmfels Date: Wed, 7 Feb 2024 11:03:56 +1100 Subject: [PATCH] podjango: Temporarily filter out episodes prior to 2024 --- conservancy/podjango/models.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/conservancy/podjango/models.py b/conservancy/podjango/models.py index 53c3db52..30b82d3d 100644 --- a/conservancy/podjango/models.py +++ b/conservancy/podjango/models.py @@ -18,7 +18,6 @@ # from datetime import datetime, timedelta -from django.conf import settings from django.db import models from django.urls import reverse @@ -30,7 +29,7 @@ class CastTag(models.Model): slug = models.SlugField() class Meta: - db_table = 'cast_tags' # legacy + db_table = 'cast_tags' # legacy def __str__(self): return self.label @@ -39,6 +38,12 @@ class CastTag(models.Model): return reverse('podjango:cast') + "?tag=%s" % self.slug +class CastManager(models.Manager): + def get_queryset(self): + # Temporarily filter out old FaiF episodes we've imported. + return super().get_queryset().filter(pub_date__year__gte=2024) + + class Cast(models.Model): """Cast""" @@ -58,8 +63,10 @@ class Cast(models.Model): date_created = models.DateTimeField(auto_now_add=True) date_last_modified = models.DateTimeField(auto_now=True) + objects = CastManager() + class Meta: - db_table = 'casts_entries' # legacy + db_table = 'casts_entries' # legacy verbose_name_plural = 'casts' ordering = ('-pub_date',) get_latest_by = 'pub_date'