diff options
-rw-r--r-- | app/posts/migrations/0028_alter_post_post_type_alter_post_title.py | 23 | ||||
-rw-r--r-- | app/posts/models.py | 11 | ||||
-rw-r--r-- | app/posts/views/range_views.py | 2 |
3 files changed, 26 insertions, 10 deletions
diff --git a/app/posts/migrations/0028_alter_post_post_type_alter_post_title.py b/app/posts/migrations/0028_alter_post_post_type_alter_post_title.py new file mode 100644 index 0000000..03b68e3 --- /dev/null +++ b/app/posts/migrations/0028_alter_post_post_type_alter_post_title.py @@ -0,0 +1,23 @@ +# Generated by Django 4.2.7 on 2024-03-07 11:19 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('posts', '0027_remove_post_template_name_post_post_topic'), + ] + + operations = [ + migrations.AlterField( + model_name='post', + name='post_type', + field=models.IntegerField(choices=[(1, 'jrnl'), (2, 'essay'), (3, 'src'), (4, 'jrnl'), (5, 'field note'), (7, 'film')], default=4), + ), + migrations.AlterField( + model_name='post', + name='title', + field=models.CharField(help_text='49 characters is ideal for essays', max_length=200), + ), + ] diff --git a/app/posts/models.py b/app/posts/models.py index c6ce559..7870b35 100644 --- a/app/posts/models.py +++ b/app/posts/models.py @@ -29,6 +29,7 @@ from media.models import LuxImage, LuxImageSize from locations.models import Location from books.models import Book from lttr.models import NewsletterMailing +from sightings.models import AP #from fieldnotes.models import FieldNote from taxonomy.models import TaggedItems, Category from utils.util import render_images, render_products, parse_video, markdown_to_html, extract_main_image @@ -68,15 +69,12 @@ class Trip(models.Model): class PostType(models.IntegerChoices): - RANGE = 0, ('range') - REVIEW = 1, ('review') ESSAY = 2, ('essay') SRC = 3, ('src') JRNL = 4, ('jrnl') FIELD_NOTE = 5, ('field note') GUIDE = 6, ('guide') FILM = 7, ('film') - CRAFT = 8, ('craft') class PostTopic(models.IntegerChoices): @@ -124,6 +122,7 @@ class Post(models.Model): originally_published_by_url = models.CharField(max_length=400, null=True, blank=True) field_notes = models.ManyToManyField('self', blank=True, symmetrical=False, limit_choices_to = {'post_type': PostType.FIELD_NOTE}) books = models.ManyToManyField(Book, blank=True) + #ap = models.ForeignKey(AP, on_delete=models.CASCADE, null=True, blank=True) class Meta: ordering = ('-pub_date',) @@ -139,14 +138,8 @@ class Post(models.Model): 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.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}) - if self.post_type == PostType.GUIDE: - return reverse('guides:guide-post-detail', kwargs={"topic": self.guide_set.all()[0].slug, "slug": self.slug}) if self.post_type == PostType.JRNL: return reverse('jrnl:detail', kwargs={"year": self.pub_date.year, "month": self.pub_date.strftime("%m"), "slug": self.slug}) diff --git a/app/posts/views/range_views.py b/app/posts/views/range_views.py index dc09cee..b358051 100644 --- a/app/posts/views/range_views.py +++ b/app/posts/views/range_views.py @@ -24,7 +24,7 @@ class RangeListView(PaginatedListView): """ model = Post template_name = "posts/range_list.html" - queryset = Post.objects.filter(post_type__in=[PostType.ESSAY,PostType.FILM,PostType.CRAFT,PostType.REVIEW],status=1).order_by('-pub_date') + queryset = Post.objects.filter(post_type__in=[PostType.ESSAY,PostType.FILM],status=1).order_by('-pub_date') def get_context_data(self, **kwargs): context = super(RangeListView, self).get_context_data(**kwargs) |