feat: article creation

This commit is contained in:
root
2025-10-08 21:30:45 +03:00
parent b11161bce3
commit 2c4f16ce60
10 changed files with 108 additions and 3 deletions

View File

@@ -13,6 +13,11 @@
<img src="{% static 'logo.svg' %}" />
<h1>Всё про IT</h1>
</div>
{% block write %}
{% if not user.is_anonymous %}
<a href="/article/new">Написать статью</a>
{% endif %}
{% endblock %}
<div class="archive">
{% for post in posts %}
<a class="post-link" href="/article/{{ post.id }}">

View File

@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Новая статья</title>
{% load static %}
<link rel="stylesheet" href="{% static 'index.css' %}">
<link rel="shortcut icon" type="image/png" href="{% static 'favicon.ico' %}"/>
</head>
<body>
<div class="header">
<img src="{% static 'logo.svg' %}" />
<h1>Всё про IT</h1>
</div>
<div class="content">
<h1>Название сатьи должно быть уникально!</h1>
</div>
<p><a href="javascript:history.back()">← Назад к редакированию статьи</a></p>
</body>
</html>

View File

@@ -0,0 +1,27 @@
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Новая статья</title>
{% load static %}
<link rel="stylesheet" href="{% static 'index.css' %}">
<link rel="shortcut icon" type="image/png" href="{% static 'favicon.ico' %}"/>
</head>
<body>
<div class="header">
<img src="{% static 'logo.svg' %}" />
<h1>Всё про IT</h1>
</div>
<div class="content">
<h1>Написать статью</h1>
<form method="POST">{% csrf_token %}
<input class="title" type="text" name="title" placeholder="Название статьи" value="{{ form.title }}">
<textarea class="text" name="text" placeholder="Текст статьи">{{ form.text }}</textarea>
<input class="submit" type="submit" value="Сохранить">
</form>
{{ form.errors }}
</div>
<p><a href="/">← Назад к списку статей</a></p>
</body>
</html>