-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #80 from veselosky/79-allow-articles-to-be-linked-…
…in-series Allow Articles to be linked in Series #79
- Loading branch information
Showing
15 changed files
with
471 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "0.2.2" | ||
__version__ = "0.2.3" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
...enericsite/migrations/0011_alter_article_options_articleseries_article_series_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Generated by Django 5.0.6 on 2024-05-26 17:41 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("genericsite", "0010_alter_attachment_file_alter_image_image_file"), | ||
("sites", "0002_alter_domain_unique"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterModelOptions( | ||
name="article", | ||
options={ | ||
"get_latest_by": "date_published", | ||
"verbose_name": "article", | ||
"verbose_name_plural": "articles", | ||
}, | ||
), | ||
migrations.CreateModel( | ||
name="ArticleSeries", | ||
fields=[ | ||
( | ||
"id", | ||
models.BigAutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
("name", models.CharField(max_length=255, verbose_name="name")), | ||
("slug", models.SlugField(verbose_name="slug")), | ||
( | ||
"description", | ||
models.TextField(blank=True, verbose_name="description"), | ||
), | ||
( | ||
"site", | ||
models.ForeignKey( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
to="sites.site", | ||
verbose_name="site", | ||
), | ||
), | ||
], | ||
), | ||
migrations.AddField( | ||
model_name="article", | ||
name="series", | ||
field=models.ForeignKey( | ||
blank=True, | ||
null=True, | ||
on_delete=django.db.models.deletion.SET_NULL, | ||
to="genericsite.articleseries", | ||
verbose_name="series", | ||
), | ||
), | ||
migrations.AlterOrderWithRespectTo( | ||
name="article", | ||
order_with_respect_to="series", | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{% extends "genericsite/base.html" %} | ||
|
||
{% block title %}{% if object.seo_title %}{{object.seo_title}} | ||
{% else %}{{object.title}}{% if object.series %} | {{object.series.name}} {{object.series_part}}{% endif %} | ||
{% endif %} | {% firstof brand request.site.name %}{% endblock %} |
23 changes: 0 additions & 23 deletions
23
src/genericsite/templates/genericsite/blocks/article_featuredimage.html
This file was deleted.
Oops, something went wrong.
34 changes: 27 additions & 7 deletions
34
src/genericsite/templates/genericsite/blocks/article_text.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,32 @@ | ||
{% with object as article %} | ||
{% load genericsite %}{% with object as article %} | ||
<article class="article-full"> | ||
<h1 class="article-title">{% firstof article.headline article.title article.schema.headline %}</h1> | ||
{% if article.author %} | ||
<p class="article-meta">{{ article.date_published|date:"DATE_FORMAT"}} | ||
<a href="{{ article.author.get_absolute_url }}">{{ article.author.name }}</a></p> | ||
{% else %} | ||
<p class="article-meta">{{ article.date_published|date:"DATE_FORMAT"}}</p> | ||
<header class="article-header"> | ||
<h1 class="article-title">{% firstof article.headline article.title article.schema.headline %}</h1> | ||
{% if article.author %} | ||
<p class="article-meta">{{ article.date_published|date:"DATE_FORMAT"}} | ||
<a href="{{ article.author.get_absolute_url }}">{{ article.author.name }}</a></p> | ||
{% else %} | ||
<p class="article-meta">{{ article.date_published|date:"DATE_FORMAT"}}</p> | ||
{% endif %} | ||
</header> | ||
{% if article.series %} | ||
<section class="article-series-info mb-3"> | ||
{% include "genericsite/includes/article_series.html" %} | ||
</section> | ||
{% endif %} | ||
{% opengraph_image article as img %} {% if img %} | ||
<p> | ||
<img class="img-fluid" src="{{img.large.url}}" alt="{{img.alt_text}}" height="{{img.large.height}}" width="{{img.large.width}}" /> | ||
</p> | ||
{% endif %} | ||
{{ article.body|safe }} | ||
{% if article.series %} | ||
<footer class="article-footer"> | ||
{% if article.get_next_in_order %} | ||
<p>Next in the series: <a href="{{article.get_next_in_order.get_absolute_url}}">{{article.get_next_in_order.title}}</a></p> | ||
{% endif %} | ||
{% include "genericsite/includes/article_series.html" %} | ||
</footer> | ||
{% endif %} | ||
</article> | ||
{% endwith %} |
18 changes: 18 additions & 0 deletions
18
src/genericsite/templates/genericsite/includes/article_series.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{% comment %} | ||
Given an article that belongs to a series, display a list of all the articles in the | ||
series, linking to all but the current article. | ||
{% endcomment %} | ||
{% with object.series as series %} | ||
{% if series %} | ||
<h2>Part of the Series: {{ series.name }}</h2> | ||
<ol class="list-group list-group-numbered"> | ||
{% for article in series.article_set.all %} | ||
{% if article != object %} | ||
<li class="list-group-item"><a href="{{ article.get_absolute_url }}">{{ article.title }}</a></li> | ||
{% else %} | ||
<li class="list-group-item">{{ article.title }}</li> | ||
{% endif %} | ||
{% endfor %} | ||
</ol> | ||
{% endif %} | ||
{% endwith %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.