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> |
||||
<form |
||||
{% extends 'base.html' %} |
||||
{% load bootstrap5 %} |
||||
{% block content %} |
||||
<div class="container"> |
||||
<div class="row my-5"> |
||||
<div class="col-md-12"> |
||||
<h1>Заполните данные статьи для продвижения в соц. сетях</h1> |
||||
<form |
||||
method="post" |
||||
enctype="application/x-www-form-urlencoded" |
||||
action="{% url 'create-article' %}" |
||||
> |
||||
class="form" |
||||
> |
||||
{% csrf_token %} |
||||
<label for="body">Краткий текст статьи</label> |
||||
<textarea id="body" name="body"></textarea> |
||||
<label for="link">Ссылка</label> |
||||
<input type="text" name="link" id="link"> |
||||
<input type="submit" value="Продвинуть"> |
||||
</form> |
||||
{% 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