feat: article creation
This commit is contained in:
@@ -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 }}">
|
||||
|
||||
21
articles/templates/article_invalid_name.html
Normal file
21
articles/templates/article_invalid_name.html
Normal 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>
|
||||
27
articles/templates/new_article.html
Normal file
27
articles/templates/new_article.html
Normal 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>
|
||||
Reference in New Issue
Block a user