Changeset - 6ce976e63a9b
[Not reviewed]
0 1 0
Ben Sturmfels (bsturmfels) - 3 months ago 2024-02-07 00:03:56
ben@sturm.com.au
podjango: Temporarily filter out episodes prior to 2024
1 file changed with 10 insertions and 3 deletions:
0 comments (0 inline, 0 general)
conservancy/podjango/models.py
Show inline comments
...
 
@@ -15,33 +15,38 @@
 
# You should have received a copy of the GNU Affero General Public License
 
# along with this program in a file in the toplevel directory called
 
# "AGPLv3".  If not, see <http://www.gnu.org/licenses/>.
 
#
 
from datetime import datetime, timedelta
 

	
 
from django.conf import settings
 
from django.db import models
 
from django.urls import reverse
 

	
 

	
 
class CastTag(models.Model):
 
    """Tagging for casts"""
 

	
 
    label = models.CharField(max_length=100)
 
    slug = models.SlugField()
 

	
 
    class Meta:
 
        db_table = 'cast_tags' # legacy
 
        db_table = 'cast_tags'  # legacy
 

	
 
    def __str__(self):
 
        return self.label
 

	
 
    def get_absolute_url(self):
 
        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"""
 

	
 
    title = models.CharField(max_length=200)
 
    slug = models.SlugField(unique=True)
 
    summary = models.TextField(help_text="Use raw HTML.  This summary is not included at the beginning of the body when the entry is displayed.  It used only for the material on the front page.")
...
 
@@ -55,14 +60,16 @@ class Cast(models.Model):
 
    ogg_length = models.IntegerField(blank=False, help_text="size in bytes of ogg file")
 
    mp3_length = models.IntegerField(blank=False, help_text="size in bytes of mp3 file")
 
    duration = models.CharField(max_length=8, blank=False, help_text="length in hh:mm:ss of mp3 file")
 
    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'
 

	
 
    def __str__(self):
 
        return self.title
0 comments (0 inline, 0 general)