Artur Galyamov
2 years ago
6 changed files with 62 additions and 25 deletions
@ -1,5 +1,9 @@ |
|||||||
from django.forms import ModelForm |
from django import forms |
||||||
|
|
||||||
|
from .models import Article |
||||||
|
|
||||||
class ArticleForm(ModelForm): |
|
||||||
pass |
class ArticleForm(forms.ModelForm): |
||||||
|
class Meta: |
||||||
|
model = Article |
||||||
|
fields = ('body', 'link',) |
||||||
|
@ -1,13 +1,28 @@ |
|||||||
<h1>Заполните данные статьи для продвижения в соц. сетях</h1> |
{% extends 'base.html' %} |
||||||
<form |
{% load bootstrap5 %} |
||||||
method="post" |
{% block content %} |
||||||
enctype="application/x-www-form-urlencoded" |
<div class="container"> |
||||||
action="{% url 'create-article' %}" |
<div class="row my-5"> |
||||||
> |
<div class="col-md-12"> |
||||||
{% csrf_token %} |
<h1>Заполните данные статьи для продвижения в соц. сетях</h1> |
||||||
<label for="body">Краткий текст статьи</label> |
<form |
||||||
<textarea id="body" name="body"></textarea> |
method="post" |
||||||
<label for="link">Ссылка</label> |
enctype="application/x-www-form-urlencoded" |
||||||
<input type="text" name="link" id="link"> |
action="{% url 'create-article' %}" |
||||||
<input type="submit" value="Продвинуть"> |
class="form" |
||||||
</form> |
> |
||||||
|
{% csrf_token %} |
||||||
|
{% bootstrap_form new_article_form %} |
||||||
|
{% buttons %} |
||||||
|
<button |
||||||
|
class="btn btn-primary" |
||||||
|
type="submit" |
||||||
|
> |
||||||
|
Продвинуть |
||||||
|
</button> |
||||||
|
{% endbuttons %} |
||||||
|
</form> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
</div> |
||||||
|
{% endblock content %} |
@ -0,0 +1,15 @@ |
|||||||
|
<!DOCTYPE html> |
||||||
|
<html lang="en"> |
||||||
|
<head> |
||||||
|
<meta charset="UTF-8"> |
||||||
|
<title>Продвижение новостей в соц. сетях</title> |
||||||
|
{% load bootstrap5 %} |
||||||
|
{% bootstrap_css %} |
||||||
|
{% bootstrap_javascript %} |
||||||
|
{% bootstrap_messages %} |
||||||
|
</head> |
||||||
|
<body> |
||||||
|
{% block content %} |
||||||
|
{% endblock content %} |
||||||
|
</body> |
||||||
|
</html> |
Loading…
Reference in new issue