<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>{% block title %} Главная {% endblock %}</title>
</head>
<body>
{% block content %}
{% if user.is_authenticated %}
{% block nav %}
<div>
<nav>
<div>
<h1>Главная</h1>
<ul>
<li>
<a href="/">Главная</a>
</li>
<li>
<a href="/posts">Блог</a>
</li>
<li>
<a href="/help">Помощь</a>
</li>
<li>
<form action="{% url 'logout' %}" method="post">
{% csrf_token %}
<button type="submit">Выйти</button>
</form>
</li>
</ul>
</div>
</nav>
</div>
{% endblock %}
<div>
{% for posts in post_title reversed %}
<h3><a href="/posts/{{ posts.id }}">{{ posts.title }}</a></h3>
{% endfor %}
</div>
{% else %}
<div>
<nav>
<div>
<div>
<h1>Главная</h1>
<ul>
<li>
<a href="/">Главная</a>
</li>
<li>
<a href="/posts">Блог</a>
</li>
<li>
<a href="/help">Помощь</a>
</li>
<li>
<form action="{% url 'login' %}" method="post">
{% csrf_token %}
<button type="submit">Войти</button>
</form>
<form action="{% url 'signup' %}" method="post">
{% csrf_token %}
<button type="submit">Регистрация</button>
</form>
</li>
</ul>
</div>
</div>
</nav>
</div>
<div>
{% for posts in post_title reversed %}
<h3><a href="/posts/{{ posts.id }}">{{ posts.title }}</a></h3>
{% endfor %}
</div>
{% endif %}
{% endblock %}
</body>
</html>
{% extends 'forum/base.html' %}
{% block title %} Новый пост {% endblock %}
{% block content %}
{% if user.is_authenticated %}
{% block nav %}
{% endblock %}
<h1>Напишите свой пост</h1>
<form action="{% url 'add_post' %}" method="post">
{% csrf_token %}
<div>
<label>
<input name="title" placeholder="Заголовок...">
</label>
</div>
<div>
<label>
<textarea name="description" placeholder="Текст поста..."></textarea>
</label>
</div>
<div><input type="submit"></div>
</form>
{% else %}
<h1>Вы не авторизованы</h1>
<form action="{% url 'login' %}" method="post">
{% csrf_token %}
<button type="submit">Войти</button>
</form>
<form action="{% url 'signup' %}" method="post">
{% csrf_token %}
<button type="submit">Регистрация</button>
</form>
{% endif %}
{% endblock %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>
{% block title %}
Главная
{% endblock %}
</title>
</head>
<body>
{% if user.is_authenticated %}
<div>
<nav>
<div>
<h1>Главная</h1>
<ul>
<li>
<a href="/">Главная</a>
</li>
<li>
<a href="/posts">Блог</a>
</li>
<li>
<a href="/help">Помощь</a>
</li>
<li>
<form action="{% url 'logout' %}" method="post">
{% csrf_token %}
<button type="submit">Выйти</button>
</form>
</li>
</ul>
</div>
</nav>
</div>
<div>
{% for posts in post_title reversed %}
<h3><a href="/posts/{{ posts.id }}">{{ posts.title }}</a></h3>
{% endfor %}
</div>
{% else %}
<div>
<nav>
<div>
<div>
<h1>Главная</h1>
<ul>
<li>
<a href="/">Главная</a>
</li>
<li>
<a href="/posts">Блог</a>
</li>
<li>
<a href="/help">Помощь</a>
</li>
<li>
<form action="{% url 'login' %}" method="post">
{% csrf_token %}
<button type="submit">Войти</button>
</form>
<form action="{% url 'signup' %}" method="post">
{% csrf_token %}
<button type="submit">Регистрация</button>
</form>
</li>
</ul>
</div>
</div>
</nav>
</div>
<div>
{% for posts in post_title reversed %}
<h3><a href="/posts/{{ posts.id }}">{{ posts.title }}</a></h3>
{% endfor %}
</div>
{% endif %}
{% block content %}
{% endblock %}
</body>
</html>
{% extends 'forum/base.html' %}
{% block title %}
Новый пост
{% endblock %}
{% block content %}
{% if user.is_authenticated %}
<h1>Напишите свой пост</h1>
<form action="{% url 'add_post' %}" method="post">
{% csrf_token %}
<div>
<label><input name="title" placeholder="Заголовок..." /></label>
</div>
<div>
<label><textarea name="description" placeholder="Текст поста..."></textarea></label>
</div>
<div>
<input type="submit" />
</div>
</form>
{% else %}
<h1>Вы не авторизованы</h1>
<form action="{% url 'login' %}" method="post">
{% csrf_token %}
<button type="submit">Войти</button>
</form>
<form action="{% url 'signup' %}" method="post">
{% csrf_token %}
<button type="submit">Регистрация</button>
</form>
{% endif %}
{% endblock %}