From d573ecad14301886c5b3ef72ce5639e33384574c Mon Sep 17 00:00:00 2001 From: luxagraf Date: Wed, 17 Jan 2024 11:35:54 -0500 Subject: gtd: added category --- app/gtd/migrations/0027_wiredpost_category.py | 20 ++++++++++++++++++++ app/gtd/models.py | 3 ++- app/gtd/templates/gtd/wiredpost_table.html | 4 ++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 app/gtd/migrations/0027_wiredpost_category.py (limited to 'app/gtd') diff --git a/app/gtd/migrations/0027_wiredpost_category.py b/app/gtd/migrations/0027_wiredpost_category.py new file mode 100644 index 0000000..e814331 --- /dev/null +++ b/app/gtd/migrations/0027_wiredpost_category.py @@ -0,0 +1,20 @@ +# Generated by Django 4.2.7 on 2024-01-17 11:28 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('taxonomy', '0007_alter_luxtag_slug_alter_taggeditems_content_type_and_more'), + ('gtd', '0026_alter_wiredpost_post_status'), + ] + + operations = [ + migrations.AddField( + model_name='wiredpost', + name='category', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='taxonomy.category'), + ), + ] diff --git a/app/gtd/models.py b/app/gtd/models.py index fd4a11a..d923d93 100644 --- a/app/gtd/models.py +++ b/app/gtd/models.py @@ -6,6 +6,7 @@ from django.apps import apps from django.utils import timezone from django.utils.html import format_html +from taxonomy.models import Category from utils.util import render_images, markdown_to_html @@ -158,10 +159,10 @@ class WiredPost(models.Model): post_type = models.IntegerField(choices=PostType.choices, default=PostType.GUIDE) template_type = models.IntegerField(choices=TemplateType.choices, default=TemplateType.STORY) update_frequency = models.BigIntegerField(help_text="In days") - # products = models.ManyToManyField(ProductLink, blank=True, null=True) needs_update = models.BooleanField(default=False) is_live = models.BooleanField(default=True) post_status = models.IntegerField(choices=PostStatus.choices, default=PostStatus.PUBLISHED) + category = models.ForeignKey(Category, on_delete=models.SET_NULL, null=True, blank=True) class Meta: ordering = ('date_last_pub',) diff --git a/app/gtd/templates/gtd/wiredpost_table.html b/app/gtd/templates/gtd/wiredpost_table.html index d80787a..a65ce9c 100644 --- a/app/gtd/templates/gtd/wiredpost_table.html +++ b/app/gtd/templates/gtd/wiredpost_table.html @@ -21,6 +21,9 @@
Edit URL
+ +
Category
+ Date last pub @@ -59,6 +62,7 @@ Date last pub edit {%else%}add{%endif%} + {{object.category.name}} {{object.date_last_pub}} {{object.post_type}}{{object.get_post_type_display}} {{object.update_frequency}} -- cgit v1.2.3-70-g09d2