Update podjango model __str__ methods for newer Django

This commit is contained in:
Ben Sturmfels 2023-10-13 12:44:28 +11:00
parent 9381e607cd
commit d9d28cf439
Signed by: bsturmfels
GPG key ID: 023C05E2C9C068F0

View file

@ -19,9 +19,9 @@
from django.db import models
from django.conf import settings
from django.urls import reverse
#from podjango.apps.staff.models import Person
from datetime import datetime, timedelta
class CastTag(models.Model):
"""Tagging for casts"""
@ -31,12 +31,13 @@ class CastTag(models.Model):
class Meta:
db_table = 'cast_tags' # legacy
def __unicode__(self):
def __str__(self):
return self.label
def get_absolute_url(self):
return reverse('podjango:cast') + "?tag=%s" % self.slug
class Cast(models.Model):
"""Cast"""
@ -45,7 +46,6 @@ class Cast(models.Model):
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.")
body = models.TextField(help_text="Use raw HTML. Include the full body of any show notes or other information about this episode. It will be labelled on the site as Show Notes. It is included on the detail entry, and in the description data on the cast RSS feed.")
pub_date = models.DateTimeField()
# poster = models.ForeignKey(Person)
tags = models.ManyToManyField(CastTag, blank=True)
ogg_path = models.CharField(max_length=300, blank=True,
help_text="Local filename of the Ogg file, relative to webroot. File should be uploaded into the static media area for casts.")
@ -63,7 +63,7 @@ class Cast(models.Model):
ordering = ('-pub_date',)
get_latest_by = 'pub_date'
def __unicode__(self):
def __str__(self):
return self.title
def get_absolute_url(self):