Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div class="container">
- {% for post in post_list_highlighted %}
- <h1><a href="{{ post.get_absolute_url }}">{{ post.title }}</a></h1>
- <p>Pubblicato il <em>{{ post.publishing_date }}</em></p>
- <small>
- {% for tags in post.tag.all %}
- <a href="{{ tags.get_absolute_url }}">{{ tags }}</a>
- {% endfor %}
- </small><br>
- <a href="{{ post.category.get_absolute_url }}">{{ post.category }}</a>
- <hr>
- {% empty %}
- <div class="jumbotron my-5">
- <h1 class="text-center">Non hai creato ancora nulla!</h1>
- </div>
- {% endfor %}
- </div>
- {% extends 'base.html' %}
- {% load static %}
- {% block head_title %}Elenco Post | {{ block.super }}{% endblock head_title %}
- {% include 'blog/list_posth.html' %}
- {% block content %}
- <div class="row">
- <div class="col-sm-10">
- {% for post in post_list %}
- <h1><a href="{{ post.get_absolute_url }}">{{ post.title }}</a></h1>
- <!-- <img class="img-fluid mx-auto d-block" src="{{ post.image }}" alt="Image of {{ post.title }}"> -->
- <p>Pubblicato il <em>{{ post.publishing_date }}</em></p>
- <small>
- {% for tags in post.tag.all %}
- <a href="{{ tags.get_absolute_url }}">{{ tags }}</a>
- {% endfor %}
- </small><br>
- <a href="{{ post.category.get_absolute_url }}">{{ post.category }}</a>
- <hr>
- {% empty %}
- <div class="jumbotron my-5">
- <h1 class="text-center">Non hai creato ancora nulla!</h1>
- </div>
- {% endfor %}
- </div>
- <div class="col-sm-2">
- <h1>Archivio</h1>
- {% regroup all_posts by publishing_date.year as year_list %}
- <ul>
- {% for year in year_list %}
- <li>{{ year.grouper }}
- {% regroup year.list by publishing_date.month as month_list %}
- <ul>
- {% for month in month_list %}
- <li><a href="{% url 'post_list_archive_month' year.grouper month.grouper %}">{{ month.list.0.publishing_date|date:'b' }} ({{ month.list|length }})</a></li>
- {% endfor %}
- </ul>
- </li>
- {% endfor %}
- </ul>
- </div>
- </div>
- {% endblock content %}
- class PostListHighlighted(ListView):
- model = Post
- queryset = Post.objects.filter(highlighted=True)
- context_object_name = 'post_list_highlighted'
- template_name = "blog/list_posth.html"
- class PostList(ListView):
- model = Post
- queryset = Post.objects.filter(highlighted=False)
- context_object_name = 'post_list'
- template_name = "blog/list_post.html"
- paginate_by = 4
- path("", PostList.as_view(), name="list_post"),
- path("highlighted/", PostListHighlighted.as_view(), name="list_post_highlighted"),
Add Comment
Please, Sign In to add comment