diff options
Diffstat (limited to 'app/posts/models.py')
-rw-r--r-- | app/posts/models.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/app/posts/models.py b/app/posts/models.py index 2ce7d96..c6ce559 100644 --- a/app/posts/models.py +++ b/app/posts/models.py @@ -76,7 +76,8 @@ class PostType(models.IntegerChoices): FIELD_NOTE = 5, ('field note') GUIDE = 6, ('guide') FILM = 7, ('film') - HOWTO = 8, ('how to') + CRAFT = 8, ('craft') + class PostTopic(models.IntegerChoices): SPIRIT = 0, ('spirit') @@ -86,7 +87,7 @@ class PostTopic(models.IntegerChoices): class Post(models.Model): site = models.ForeignKey(Site, on_delete=models.SET_NULL, default=1, null=True) - title = models.CharField(max_length=200) + title = models.CharField(max_length=200,help_text="49 characters is ideal for essays") short_title = models.CharField(max_length=200, blank=True, null=True) subtitle = models.CharField(max_length=200, blank=True) slug = models.SlugField(unique_for_date='pub_date') @@ -135,12 +136,12 @@ class Post(models.Model): if self.post_type == PostType.FILM: return reverse('film:detail', kwargs={"slug": self.slug}) if self.post_type == PostType.ESSAY: - return reverse('essays:detail', kwargs={"slug": self.slug}) + return reverse('essays:detail', kwargs={"cat": self.get_post_topic_display(), "slug": self.slug}) if self.post_type == PostType.SRC: return reverse('src:detail', kwargs={"slug": self.slug}) if self.post_type == PostType.REVIEW: return reverse('reviews:review-detail', kwargs={"slug": self.slug}) - if self.post_type == PostType.HOWTO: + if self.post_type == PostType.CRAFT: return reverse('craft:craft-detail', kwargs={"slug": self.slug}) if self.post_type == PostType.FIELD_NOTE: return reverse('fieldnote:detail', kwargs={"year": self.pub_date.year, "month": self.pub_date.strftime("%m"), "slug": self.slug}) |