Compare commits

..

No commits in common. "28bbef0ea535453e1374a0535846d54470cf808d" and "98884e2ddf70e29e4668ea832e90c62ea68bfd3f" have entirely different histories.

4 changed files with 11 additions and 41 deletions

View File

@ -1,9 +0,0 @@
# News
TODO: Add the header image into the news item list view.
TODO: Add the header image into the news item detail view.
TODO: Add the origin text into the news item list view.
TODO: Add the origin text into the news item detail view.
TODO: Create a RedirectView for the origin link.
TODO: On clicking the origin link, add one to the origin followed count.

View File

@ -1,23 +0,0 @@
# Generated by Django 5.2.8 on 2025-11-10 19:55
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("news", "0001_initial"),
]
operations = [
migrations.AddField(
model_name="newsitem",
name="origin_text",
field=models.CharField(blank=True, max_length=200, null=True),
),
migrations.AlterField(
model_name="newsitem",
name="origin_times_followed",
field=models.PositiveIntegerField(default=0),
),
]

View File

@ -33,9 +33,8 @@ class NewsItem(models.Model):
Category, on_delete=models.PROTECT, related_name="news_items" Category, on_delete=models.PROTECT, related_name="news_items"
) )
body = MarkdownxField() body = MarkdownxField()
origin_text = models.CharField(max_length=200, blank=True, null=True)
origin_link = models.URLField(blank=True, null=True) origin_link = models.URLField(blank=True, null=True)
origin_times_followed = models.PositiveIntegerField(default=0) origin_times_followed = models.PositiveIntegerField()
header_img = models.ImageField(blank=True, null=True) header_img = models.ImageField(blank=True, null=True)
tags = TagField( tags = TagField(
force_lowercase=True, force_lowercase=True,

View File

@ -5,6 +5,11 @@
{% if object_list %} {% if object_list %}
{% if category %} {% if category %}
<h3>{{ category }} News</h3> <h3>{{ category }} News</h3>
<!-- {% if category.introduction %} -->
<!-- <div> -->
<!-- <p>{{ category.introduction }}</p> -->
<!-- </div> -->
<!-- {% endif %} -->
{% elif tag %} {% elif tag %}
<h3>News for tag: {{ tag }}</h3> <h3>News for tag: {{ tag }}</h3>
{% else %} {% else %}
@ -12,16 +17,14 @@
{% endif %} {% endif %}
<hr> <hr>
<div> <div>
{% for newsitem in object_list %} {% for news in object_list %}
<div> <div>
<a href="{{ newsitem.get_absolute_url }}">{{ newsitem.title }}</a> <a href="{{ news.get_absolute_url }}">{{ news.title }}</a>
<hr> <hr >
{{ newsitem.body_as_markdown|safe }}
<hr>
<div> <div>
<span> <span>
<a href="{% url 'news:list_category' category=newsitem.category.slug %}">{{ newsitem.category }} </a> <a href="{% url 'news:list_category' category=news.category.slug %}">{{ news.category }} </a>
&bull; {{ newsitem.created_at | date:'jS \o\f F, Y' }} &bull; {{ news.created | date:'jS \o\f F, Y' }}
</span> </span>
<span>{% include 'news/includes/display_tags.html' %}</span> <span>{% include 'news/includes/display_tags.html' %}</span>
</div> </div>