Skip to content
Snippets Groups Projects
Commit 62a99799 authored by Todd Dembrey's avatar Todd Dembrey
Browse files

Add the news listing to the project page

parent 9d1e526c
No related branches found
No related tags found
No related merge requests found
......@@ -20,7 +20,7 @@ class Migration(migrations.Migration):
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('sort_order', models.IntegerField(blank=True, editable=False, null=True)),
('page', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to='wagtailcore.Page')),
('page', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='news_mentions', to='wagtailcore.Page')),
('source_page', modelcluster.fields.ParentalKey(on_delete=django.db.models.deletion.CASCADE, related_name='related_projects', to='news.NewsPage')),
],
options={
......
......@@ -53,6 +53,13 @@ class NewsPageRelatedPage(RelatedPage):
class NewsProjectRelatedPage(RelatedPage):
page = models.ForeignKey(
'wagtailcore.Page',
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name='news_mentions',
)
source_page = ParentalKey(
'news.NewsPage',
related_name='related_projects'
......
......@@ -44,4 +44,14 @@
</ul>
{% endfor %}
{% if page.news_mentions.all %}
<h4 class="heading">We wrote about it</h4>
<ul class="list">
{% for news in page.news_mentions.all %}
<li><a href="{% pageurl news.source_page %}">{{ news.source_page }}</a></li>
{% endfor %}
</ul>
{% endif %}
{% endblock content %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment