python - How to post on multiple pages using django -
for project, trying build basic forum-like website; however, trying post on multiple pages instead of 1 , cannot add extend on part allows post added page:
{% extends 'blog/base.html' %} {% block content %} <div class="post"> {% if post.published_date %} <div class="date"> {{ post.published_date }} </div> {% endif %} {% if user.is_authenticated %} <a class="btn btn-default" href="{% url 'post_edit' pk=post.pk %}"><span class="glyphicon glyphicon-pencil"></span></a> {% endif %} <h1>{{ post.title }}</h1> <p>{{ post.text|linebreaksbr }}</p> </div> {% endblock %}
is there way make website display these posts on multiple pages using method?
i guess asking "include" keyword? , "with" template tag?
post_template.html
<div class="post"> {% if post.published_date %} <div class="date"> {{ post.published_date }} </div> {% endif %} {% if user.is_authenticated %} <a class="btn btn-default" href="{% url 'post_edit' pk=post.pk %}"><span class="glyphicon glyphicon-pencil"></span></a> {% endif %} <h1>{{ post.title }}</h1> <p>{{ post.text|linebreaksbr }}</p> </div>
some_page.html
{% extends "base.html" %} {% some_post post %}{% include "post_template.html"%} {% endwith %}
other_page.html
{% extends "base.html" %} {% some_other_post post %}{% include "post_template.html"%} {% endwith %}
Comments
Post a Comment