diff --git a/main/models.py b/main/models.py index f8817a7107f0833eb2266836b4edbfe651ac9907..4127fb07853f5a7f452a8de3173184899479c5f2 100644 --- a/main/models.py +++ b/main/models.py @@ -160,7 +160,9 @@ class MainHomePage(MenuMixin, ExtendedMetadataHomePageMixin, MetadataPageMixin, def get_context(self, request, *args, **kwargs): context = super().get_context(request, args, kwargs) - context["tweet_list"] = Tweet.objects.order_by("-twitter_id")[:4] + tweet_list = Tweet.objects.order_by("-twitter_id") + context["tweet_list"] = tweet_list[:4] + context["show_next_tweet"] = len(tweet_list) > 4 context["regions"] = REGION_CHOICES last_month = timezone.now().today().replace(day=1) - timedelta(days=1) first_day_of_last_month = last_month.replace(day=1) diff --git a/main/templates/main/blocks/twitter_block.html b/main/templates/main/blocks/twitter_block.html index 991df7b5c76797d0c77b871461a26c6674ca4d8b..34c4631fc85ad0b85bd84129f1e0630638127eff 100644 --- a/main/templates/main/blocks/twitter_block.html +++ b/main/templates/main/blocks/twitter_block.html @@ -5,7 +5,7 @@ <div id="tweetsList"> {% include 'main/includes/twitter_widget.html' with tweet_list=tweet_list %} </div> - {% if tweet_list.has_next %} + {% if show_next_tweet %} <div class="text-center"> <a onclick="showMoreTweets(this)"