diff --git a/cms/forms.py b/cms/forms.py
index fdefe50..a2fb53f 100644
--- a/cms/forms.py
+++ b/cms/forms.py
@@ -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',)
diff --git a/cms/models.py b/cms/models.py
index a7dd029..18197c5 100644
--- a/cms/models.py
+++ b/cms/models.py
@@ -3,4 +3,4 @@ from django.db import models
class Article(models.Model):
body = models.TextField()
- link = models.CharField(max_length=100, default='https://zakonvremeni.ru/news/')
+ link = models.CharField(max_length=300, default='https://zakonvremeni.ru/news/')
diff --git a/cms/templates/articles/new.html b/cms/templates/articles/new.html
index d125fec..8cb6193 100644
--- a/cms/templates/articles/new.html
+++ b/cms/templates/articles/new.html
@@ -1,13 +1,28 @@
-
Заполните данные статьи для продвижения в соц. сетях
-
\ No newline at end of file
+{% extends 'base.html' %}
+{% load bootstrap5 %}
+{% block content %}
+
+
+
+
Заполните данные статьи для продвижения в соц. сетях
+
+
+
+
+{% endblock content %}
\ No newline at end of file
diff --git a/cms/templates/base.html b/cms/templates/base.html
new file mode 100644
index 0000000..ce7363c
--- /dev/null
+++ b/cms/templates/base.html
@@ -0,0 +1,15 @@
+
+
+
+
+ Продвижение новостей в соц. сетях
+ {% load bootstrap5 %}
+ {% bootstrap_css %}
+ {% bootstrap_javascript %}
+ {% bootstrap_messages %}
+
+
+ {% block content %}
+ {% endblock content %}
+
+
\ No newline at end of file
diff --git a/cms/views.py b/cms/views.py
index b59142c..7cd6a56 100644
--- a/cms/views.py
+++ b/cms/views.py
@@ -1,14 +1,14 @@
import os
-from json import JSONDecoder, JSONEncoder
+from json import JSONEncoder
import requests
from django.http import JsonResponse, HttpRequest
from django.shortcuts import render
from django.utils.decorators import method_decorator
from django.views import View
-from django.urls import reverse
from django.views.decorators.csrf import csrf_exempt
+from cms.forms import ArticleForm
from cms.models import Article
@@ -83,8 +83,10 @@ class ArticleView(View):
def new_article(request):
+ article_form = ArticleForm()
+ article_context = {
+ 'new_article_form': article_form
+ }
return render(request,
- template_name='articles/new.html',)
-
-
-
+ template_name='articles/new.html',
+ context=article_context)
diff --git a/crossposting_backend/settings.py b/crossposting_backend/settings.py
index ec01258..a264ca4 100644
--- a/crossposting_backend/settings.py
+++ b/crossposting_backend/settings.py
@@ -41,7 +41,8 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
- 'cms'
+ 'cms',
+ 'bootstrap5',
]
MIDDLEWARE = [
@@ -59,7 +60,7 @@ ROOT_URLCONF = 'crossposting_backend.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
- 'DIRS': [],
+ 'DIRS': [BASE_DIR / 'templates'],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [