diff options
-rw-r--r-- | app/gtd/migrations/0027_wiredpost_category.py | 20 | ||||
-rw-r--r-- | app/gtd/models.py | 3 | ||||
-rw-r--r-- | app/gtd/templates/gtd/wiredpost_table.html | 4 |
3 files changed, 26 insertions, 1 deletions
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 @@ <th scope="col" class="column-admin_url"> <div class="text"><span>Edit URL</span></div> </th> +<th scope="col" class="column-admin_url"> + <div class="text"><span>Category</span></div> +</th> <th scope="col" class="sortable column-date_last_pub sorted ascending"> Date last pub </th> @@ -59,6 +62,7 @@ Date last pub edit </a>{%else%}<a href="{% url 'gtd:wiredpost-edit' object.pk %}">add</a>{%endif%} </td> + <td class="field-date_last_pub nowrap">{{object.category.name}}</td> <td class="field-date_last_pub nowrap">{{object.date_last_pub}}</td> <td class="field-post_type"><span class="hide">{{object.post_type}}</span>{{object.get_post_type_display}}</td> <td class="field-update_frequency">{{object.update_frequency}}</td> |