diff --git a/cms/forms.py b/cms/forms.py
index a2fb53f..48e66aa 100644
--- a/cms/forms.py
+++ b/cms/forms.py
@@ -1,4 +1,5 @@
from django import forms
+from django.contrib.auth import models as auth_models
from .models import Article
@@ -7,3 +8,11 @@ class ArticleForm(forms.ModelForm):
class Meta:
model = Article
fields = ('body', 'link',)
+
+
+class UserForm(forms.ModelForm):
+ password = forms.PasswordInput()
+
+ class Meta:
+ model = auth_models.User
+ fields = ('username', 'password',)
diff --git a/cms/templates/user/sign_in.html b/cms/templates/user/sign_in.html
new file mode 100644
index 0000000..0e0cb94
--- /dev/null
+++ b/cms/templates/user/sign_in.html
@@ -0,0 +1,26 @@
+{% extends 'base.html' %}
+{% load bootstrap5 %}
+{% block content %}
+
+{% endblock %}
\ No newline at end of file
diff --git a/cms/urls.py b/cms/urls.py
index 0f5fd29..2ac74d8 100644
--- a/cms/urls.py
+++ b/cms/urls.py
@@ -1,8 +1,13 @@
from django.urls import path
-from .views import ArticleView, new_article
+from .views import ArticleView, new_article, AuthenticationView
urlpatterns = [
path('articles/', ArticleView.as_view(), name='create-article'),
path('articles/new/', new_article, name='new-article'),
+ path(
+ '',
+ AuthenticationView.as_view(),
+ name='authenticate'
+ )
]
diff --git a/cms/views.py b/cms/views.py
index 853657e..784ba5b 100644
--- a/cms/views.py
+++ b/cms/views.py
@@ -3,10 +3,13 @@ from json import JSONEncoder
import requests
from django.http import HttpRequest
+from django.http import HttpResponse
from django.shortcuts import render
from django.views import View
+from django.views import View as BaseView
from cms.forms import ArticleForm
+from cms.forms import UserForm
from cms.models import Article
@@ -86,3 +89,17 @@ def new_article(request):
return render(request,
template_name='articles/new.html',
context=article_context)
+
+
+class AuthenticationView(BaseView):
+ def get(self, request, *args, **kwargs):
+ user_form = UserForm()
+ auth_context = {
+ 'user_form': user_form,
+ }
+ return render(request,
+ 'user/sign_in.html',
+ context=auth_context)
+
+ def post(self, request, *args, **kwargs):
+ return HttpResponse('ok')
diff --git a/crossposting_backend/urls.py b/crossposting_backend/urls.py
index 9dd2af0..ee6aecb 100644
--- a/crossposting_backend/urls.py
+++ b/crossposting_backend/urls.py
@@ -15,8 +15,10 @@ Including another URLconf
"""
from django.contrib import admin
from django.urls import path, include
+from .views import handle_root_path
urlpatterns = [
path('admin/', admin.site.urls),
path('cms/', include('cms.urls')),
+ path('', handle_root_path, name='root'),
]
diff --git a/crossposting_backend/views.py b/crossposting_backend/views.py
new file mode 100644
index 0000000..1497406
--- /dev/null
+++ b/crossposting_backend/views.py
@@ -0,0 +1,8 @@
+from django.http import HttpResponseRedirect
+from django.urls import reverse
+
+
+def handle_root_path(request):
+ return HttpResponseRedirect(reverse('authenticate'))
+
+