podjango: Temporarily filter out episodes prior to 2024

This commit is contained in:
Ben Sturmfels 2024-02-07 11:03:56 +11:00
parent 4a2ed6714a
commit 6ce976e63a
Signed by: bsturmfels
GPG key ID: 023C05E2C9C068F0

View file

@ -18,7 +18,6 @@
# #
from datetime import datetime, timedelta from datetime import datetime, timedelta
from django.conf import settings
from django.db import models from django.db import models
from django.urls import reverse from django.urls import reverse
@ -30,7 +29,7 @@ class CastTag(models.Model):
slug = models.SlugField() slug = models.SlugField()
class Meta: class Meta:
db_table = 'cast_tags' # legacy db_table = 'cast_tags' # legacy
def __str__(self): def __str__(self):
return self.label return self.label
@ -39,6 +38,12 @@ class CastTag(models.Model):
return reverse('podjango:cast') + "?tag=%s" % self.slug 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): class Cast(models.Model):
"""Cast""" """Cast"""
@ -58,8 +63,10 @@ class Cast(models.Model):
date_created = models.DateTimeField(auto_now_add=True) date_created = models.DateTimeField(auto_now_add=True)
date_last_modified = models.DateTimeField(auto_now=True) date_last_modified = models.DateTimeField(auto_now=True)
objects = CastManager()
class Meta: class Meta:
db_table = 'casts_entries' # legacy db_table = 'casts_entries' # legacy
verbose_name_plural = 'casts' verbose_name_plural = 'casts'
ordering = ('-pub_date',) ordering = ('-pub_date',)
get_latest_by = 'pub_date' get_latest_by = 'pub_date'