Updated sorting for issue and landing page - exclude inquiry category

main
Domen Kosmač 2022-12-23 13:27:11 +01:00
parent a351ad52df
commit ef2eb4c9d3
4 changed files with 10 additions and 2 deletions

View File

@ -154,6 +154,12 @@ class Issue(models.Model):
else:
return self.articles.all()
def get_ordered_articles(self):
if self.published:
return self.articles.filter(published=True).exclude(category__slug='inquiry').order_by('featured__order_on_homepage')
else:
return self.articles.all()
# Use h2 or h3 in footer depending on the length of the title.
def get_title_header(self):
if len(self.title) > 30:

View File

@ -69,7 +69,7 @@ def view_article(request, slug):
# If there are other languages, add the main article (for English).
translations.append(article)
articles = article.issue.get_articles().filter(published=True).order_by('featured__order_on_homepage')
articles = article.issue.get_ordered_articles()
context = {
'translations': translations,
'article': article,

View File

@ -52,7 +52,7 @@
</div>
<br />
<div class="ui three column stackable grid" style="padding-left:15px">
{% for article in issue.get_articles %}
{% for article in issue.get_ordered_articles %}
<div class="column">
{% include 'article_thumb.html' with article=article only %}
</div>

View File

@ -27,6 +27,7 @@
<div class="ui basic segment">
<div class="ui stackable grid">
<div class="thirteen wide column">
<br>
<h1 class="ui header">
{{ page.title }}
<div class="sub header">
@ -38,6 +39,7 @@
</div>
</div>
<div class="three wide column">
<br><br>
{% include "ads.html" %}
</div>
</div>