From fbb4637a77dc5982b4e694dd31a0aa7d11cec17c Mon Sep 17 00:00:00 2001 From: Andrea Lepori Date: Thu, 18 Jun 2020 23:17:08 +0200 Subject: initial commit --- .gitignore | 2 + accounts/__init__.py | 0 accounts/admin.py | 3 + accounts/apps.py | 5 ++ accounts/migrations/__init__.py | 0 accounts/models.py | 3 + accounts/templates/accounts/signup.html | 12 +++ accounts/tests.py | 3 + accounts/urls.py | 7 ++ accounts/views.py | 10 +++ client/__init__.py | 0 client/admin.py | 3 + client/apps.py | 5 ++ client/migrations/0001_initial.py | 31 ++++++++ client/migrations/0002_usercode_user.py | 21 +++++ client/migrations/__init__.py | 0 client/models.py | 18 +++++ client/templates/client/approve.html | 18 +++++ client/templates/client/index.html | 36 +++++++++ client/tests.py | 3 + client/urls.py | 8 ++ client/views.py | 32 ++++++++ manage.py | 21 +++++ manager/__init__.py | 0 manager/asgi.py | 16 ++++ manager/settings.py | 125 ++++++++++++++++++++++++++++++ manager/urls.py | 25 ++++++ manager/wsgi.py | 16 ++++ server/__init__.py | 0 server/admin.py | 3 + server/apps.py | 5 ++ server/migrations/__init__.py | 0 server/models.py | 3 + server/templates/server/approve_user.html | 34 ++++++++ server/templates/server/index.html | 61 +++++++++++++++ server/templates/server/user_list.html | 36 +++++++++ server/tests.py | 3 + server/urls.py | 9 +++ server/views.py | 100 ++++++++++++++++++++++++ templates/registration/base.html | 19 +++++ templates/registration/login.html | 12 +++ 41 files changed, 708 insertions(+) create mode 100644 .gitignore create mode 100644 accounts/__init__.py create mode 100644 accounts/admin.py create mode 100644 accounts/apps.py create mode 100644 accounts/migrations/__init__.py create mode 100644 accounts/models.py create mode 100644 accounts/templates/accounts/signup.html create mode 100644 accounts/tests.py create mode 100644 accounts/urls.py create mode 100644 accounts/views.py create mode 100644 client/__init__.py create mode 100644 client/admin.py create mode 100644 client/apps.py create mode 100644 client/migrations/0001_initial.py create mode 100644 client/migrations/0002_usercode_user.py create mode 100644 client/migrations/__init__.py create mode 100644 client/models.py create mode 100644 client/templates/client/approve.html create mode 100644 client/templates/client/index.html create mode 100644 client/tests.py create mode 100644 client/urls.py create mode 100644 client/views.py create mode 100644 manage.py create mode 100644 manager/__init__.py create mode 100644 manager/asgi.py create mode 100644 manager/settings.py create mode 100644 manager/urls.py create mode 100644 manager/wsgi.py create mode 100644 server/__init__.py create mode 100644 server/admin.py create mode 100644 server/apps.py create mode 100644 server/migrations/__init__.py create mode 100644 server/models.py create mode 100644 server/templates/server/approve_user.html create mode 100644 server/templates/server/index.html create mode 100644 server/templates/server/user_list.html create mode 100644 server/tests.py create mode 100644 server/urls.py create mode 100644 server/views.py create mode 100644 templates/registration/base.html create mode 100644 templates/registration/login.html diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7668361 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +**/__pycache__ +**/*.pyc diff --git a/accounts/__init__.py b/accounts/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/accounts/admin.py b/accounts/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/accounts/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/accounts/apps.py b/accounts/apps.py new file mode 100644 index 0000000..9b3fc5a --- /dev/null +++ b/accounts/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class AccountsConfig(AppConfig): + name = 'accounts' diff --git a/accounts/migrations/__init__.py b/accounts/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/accounts/models.py b/accounts/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/accounts/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/accounts/templates/accounts/signup.html b/accounts/templates/accounts/signup.html new file mode 100644 index 0000000..e1591aa --- /dev/null +++ b/accounts/templates/accounts/signup.html @@ -0,0 +1,12 @@ +{% extends 'registration/base.html' %} + +{% block title %}Iscriviti{% endblock %} + +{% block content %} +

Iscriviti

+
+ {% csrf_token %} + {{ form.as_p }} + +
+{% endblock %} \ No newline at end of file diff --git a/accounts/tests.py b/accounts/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/accounts/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/accounts/urls.py b/accounts/urls.py new file mode 100644 index 0000000..d89128b --- /dev/null +++ b/accounts/urls.py @@ -0,0 +1,7 @@ +from django.urls import path + +from . import views + +urlpatterns = [ + path('signup/', views.SignUp.as_view(), name='signup'), +] diff --git a/accounts/views.py b/accounts/views.py new file mode 100644 index 0000000..0483fad --- /dev/null +++ b/accounts/views.py @@ -0,0 +1,10 @@ +from django.shortcuts import render +from django.contrib.auth.forms import UserCreationForm +from django.urls import reverse_lazy +from django.views import generic + + +class SignUp(generic.CreateView): + form_class = UserCreationForm + success_url = reverse_lazy('login') + template_name = 'accounts/signup.html' diff --git a/client/__init__.py b/client/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/client/admin.py b/client/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/client/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/client/apps.py b/client/apps.py new file mode 100644 index 0000000..4f5a8a5 --- /dev/null +++ b/client/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class ClientConfig(AppConfig): + name = 'client' diff --git a/client/migrations/0001_initial.py b/client/migrations/0001_initial.py new file mode 100644 index 0000000..d680877 --- /dev/null +++ b/client/migrations/0001_initial.py @@ -0,0 +1,31 @@ +# Generated by Django 3.0.7 on 2020-06-18 16:25 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Document', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('code', models.IntegerField(default=0)), + ], + options={ + 'permissions': [('approved', 'The user is approved')], + }, + ), + migrations.CreateModel( + name='UserCode', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('code', models.IntegerField(default=0)), + ], + ), + ] diff --git a/client/migrations/0002_usercode_user.py b/client/migrations/0002_usercode_user.py new file mode 100644 index 0000000..aaaf193 --- /dev/null +++ b/client/migrations/0002_usercode_user.py @@ -0,0 +1,21 @@ +# Generated by Django 3.0.7 on 2020-06-18 16:41 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('client', '0001_initial'), + ] + + operations = [ + migrations.AddField( + model_name='usercode', + name='user', + field=models.ForeignKey(default=None, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), + ), + ] diff --git a/client/migrations/__init__.py b/client/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/client/models.py b/client/models.py new file mode 100644 index 0000000..970c489 --- /dev/null +++ b/client/models.py @@ -0,0 +1,18 @@ +from django.db import models +from django.contrib.auth.models import User + +# Create your models here. + + +class Document(models.Model): + code = models.IntegerField(default=0) + + class Meta: + permissions = [ + ("approved", "The user is approved") + ] + + +class UserCode(models.Model): + code = models.IntegerField(default=0) + user = models.ForeignKey(User, default=None, on_delete=models.CASCADE) diff --git a/client/templates/client/approve.html b/client/templates/client/approve.html new file mode 100644 index 0000000..026a66d --- /dev/null +++ b/client/templates/client/approve.html @@ -0,0 +1,18 @@ +{% extends 'registration/base.html' %} + +{% block title %}Approva{% endblock %} + +{% block nav %} + +{% endblock %} + +{% block content %} +{{ code }} +{% endblock %} \ No newline at end of file diff --git a/client/templates/client/index.html b/client/templates/client/index.html new file mode 100644 index 0000000..2c55dbc --- /dev/null +++ b/client/templates/client/index.html @@ -0,0 +1,36 @@ +{% extends 'registration/base.html' %} + +{% block title %}Home{% endblock %} + +{%block nav%} + +{% endblock%} + +{% block content %} +{% if user.is_authenticated %} + {% if user.is_staff %} + Ciao {{ user.username }}! +

admin + logout

+ {% elif perms.client.approved %} + Ciao {{ user.username }}! +

logout

+ {% else %} + Il tuo utente non e` ancora stato approvato. +

approva + logout

+ {% endif %} +{% else %} +

Non hai fatto il login

+

login + registrazione

+{% endif %} +{% endblock %} \ No newline at end of file diff --git a/client/tests.py b/client/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/client/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/client/urls.py b/client/urls.py new file mode 100644 index 0000000..4e9f08e --- /dev/null +++ b/client/urls.py @@ -0,0 +1,8 @@ +from django.urls import path + +from . import views + +urlpatterns = [ + path('', views.index, name='index'), + path('approve', views.approve, name='approve') +] diff --git a/client/views.py b/client/views.py new file mode 100644 index 0000000..5a8f808 --- /dev/null +++ b/client/views.py @@ -0,0 +1,32 @@ +from random import randint + +from django.shortcuts import render + +from .models import UserCode + +# Create your views here. + + +def index(request): + context = {} + return render(request, 'client/index.html', context) + + +def approve(request): + context = {} + if not (request.user.is_staff or request.user.has_perm('approved')): + users = UserCode.objects.filter(user=request.user) + code = None + if (len(users) == 0): + while (True): + code = randint(100000, 999999) + if len(UserCode.objects.filter(code=code)) == 0: + break + userCode = UserCode(user=request.user, code=code) + userCode.save() + else: + code = UserCode.objects.filter(user=request.user)[0].code + context = {'code': 'U' + str(code), } + return render(request, 'client/approve.html', context) + else: + return render(request, 'client/index.html', context) diff --git a/manage.py b/manage.py new file mode 100644 index 0000000..00806fc --- /dev/null +++ b/manage.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python +"""Django's command-line utility for administrative tasks.""" +import os +import sys + + +def main(): + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'manager.settings') + try: + from django.core.management import execute_from_command_line + except ImportError as exc: + raise ImportError( + "Couldn't import Django. Are you sure it's installed and " + "available on your PYTHONPATH environment variable? Did you " + "forget to activate a virtual environment?" + ) from exc + execute_from_command_line(sys.argv) + + +if __name__ == '__main__': + main() diff --git a/manager/__init__.py b/manager/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/manager/asgi.py b/manager/asgi.py new file mode 100644 index 0000000..7400648 --- /dev/null +++ b/manager/asgi.py @@ -0,0 +1,16 @@ +""" +ASGI config for manager project. + +It exposes the ASGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/ +""" + +import os + +from django.core.asgi import get_asgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'manager.settings') + +application = get_asgi_application() diff --git a/manager/settings.py b/manager/settings.py new file mode 100644 index 0000000..169c56e --- /dev/null +++ b/manager/settings.py @@ -0,0 +1,125 @@ +""" +Django settings for manager project. + +Generated by 'django-admin startproject' using Django 3.0.7. + +For more information on this file, see +https://docs.djangoproject.com/en/3.0/topics/settings/ + +For the full list of settings and their values, see +https://docs.djangoproject.com/en/3.0/ref/settings/ +""" + +import os + +# Build paths inside the project like this: os.path.join(BASE_DIR, ...) +BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) + + +# Quick-start development settings - unsuitable for production +# See https://docs.djangoproject.com/en/3.0/howto/deployment/checklist/ + +# SECURITY WARNING: keep the secret key used in production secret! +SECRET_KEY = 'b4ns!4$%k2w%h=a&p+w6*a4(t_rkna4ax8^s66vzxtrr&b!lb#' + +# SECURITY WARNING: don't run with debug turned on in production! +DEBUG = True + +ALLOWED_HOSTS = [] + + +# Application definition + +INSTALLED_APPS = [ + 'server.apps.ServerConfig', + 'accounts.apps.AccountsConfig', + 'client.apps.ClientConfig', + 'django.contrib.admin', + 'django.contrib.auth', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.messages', + 'django.contrib.staticfiles', +] + +MIDDLEWARE = [ + 'django.middleware.security.SecurityMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.middleware.csrf.CsrfViewMiddleware', + 'django.contrib.auth.middleware.AuthenticationMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', + 'django.middleware.clickjacking.XFrameOptionsMiddleware', +] + +ROOT_URLCONF = 'manager.urls' + +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [os.path.join(BASE_DIR, 'templates')], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + +WSGI_APPLICATION = 'manager.wsgi.application' + + +# Database +# https://docs.djangoproject.com/en/3.0/ref/settings/#databases + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.sqlite3', + 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), + } +} + + +# Password validation +# https://docs.djangoproject.com/en/3.0/ref/settings/#auth-password-validators + +AUTH_PASSWORD_VALIDATORS = [ + { + 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', + }, + { + 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', + }, +] + + +# Internationalization +# https://docs.djangoproject.com/en/3.0/topics/i18n/ + +LANGUAGE_CODE = 'it-ch' + +TIME_ZONE = 'Europe/Zurich' + +USE_I18N = True + +USE_L10N = True + +USE_TZ = True + + +# Static files (CSS, JavaScript, Images) +# https://docs.djangoproject.com/en/3.0/howto/static-files/ + +STATIC_URL = '/static/' +LOGIN_REDIRECT_URL = '/' +LOGOUT_REDIRECT_URL = '/' diff --git a/manager/urls.py b/manager/urls.py new file mode 100644 index 0000000..a2c0ebf --- /dev/null +++ b/manager/urls.py @@ -0,0 +1,25 @@ +"""manager URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/3.0/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: path('', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.urls import include, path + 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) +""" +from django.contrib import admin +from django.urls import path, include + +urlpatterns = [ + path('', include('client.urls')), + path('server/', include('server.urls')), + path('accounts/', include('accounts.urls')), + path('accounts/', include('django.contrib.auth.urls')), + path('admin/', admin.site.urls), +] diff --git a/manager/wsgi.py b/manager/wsgi.py new file mode 100644 index 0000000..74a48b4 --- /dev/null +++ b/manager/wsgi.py @@ -0,0 +1,16 @@ +""" +WSGI config for manager project. + +It exposes the WSGI callable as a module-level variable named ``application``. + +For more information on this file, see +https://docs.djangoproject.com/en/3.0/howto/deployment/wsgi/ +""" + +import os + +from django.core.wsgi import get_wsgi_application + +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'manager.settings') + +application = get_wsgi_application() diff --git a/server/__init__.py b/server/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/server/admin.py b/server/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/server/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/server/apps.py b/server/apps.py new file mode 100644 index 0000000..f6bd99a --- /dev/null +++ b/server/apps.py @@ -0,0 +1,5 @@ +from django.apps import AppConfig + + +class ServerConfig(AppConfig): + name = 'server' diff --git a/server/migrations/__init__.py b/server/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/server/models.py b/server/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/server/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/server/templates/server/approve_user.html b/server/templates/server/approve_user.html new file mode 100644 index 0000000..ae9dc8b --- /dev/null +++ b/server/templates/server/approve_user.html @@ -0,0 +1,34 @@ +{% extends 'registration/base.html' %} + +{% block title %}Admin - Approva Utente{% endblock %} + +{% block nav %} + +{% endblock %} + +{% block content %} +

Inserire un codice per riga

+ +
+ {% csrf_token %} + +

+ +
+{% endblock %} \ No newline at end of file diff --git a/server/templates/server/index.html b/server/templates/server/index.html new file mode 100644 index 0000000..4790a1d --- /dev/null +++ b/server/templates/server/index.html @@ -0,0 +1,61 @@ +{% extends 'registration/base.html' %} + +{% block title %}Admin{% endblock %} + +{% block nav %} + +{% endblock %} + +{% block content %} +
+
+
+
+

+ + + + + + + + + {% for user in users %} + + {% for att in user %} + + {% endfor %} + + {% endfor %} +
UsernameNomeCognomeCodiceStato
{{att}}
+

+
+ +
+
+
+
+
+

I am a very simple card. I am good at containing small bits of information. + I am convenient because I require little markup to use effectively.

+
+ +
+
+
+{% endblock %} \ No newline at end of file diff --git a/server/templates/server/user_list.html b/server/templates/server/user_list.html new file mode 100644 index 0000000..daf7303 --- /dev/null +++ b/server/templates/server/user_list.html @@ -0,0 +1,36 @@ +{% extends 'registration/base.html' %} + +{% block title %}Admin - Lista Utenti{% endblock %} + +{% block nav %} + +{% endblock %} + +{% block content %} + + + + + + + + + {% for user in users %} + + {% for att in user %} + + {% endfor %} + + {% endfor %} +
UsernameNomeCognomeCodiceStato
{{att}}
+{% endblock %} \ No newline at end of file diff --git a/server/tests.py b/server/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/server/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/server/urls.py b/server/urls.py new file mode 100644 index 0000000..a41b346 --- /dev/null +++ b/server/urls.py @@ -0,0 +1,9 @@ +from django.urls import path + +from . import views + +urlpatterns = [ + path('', views.index, name='server'), + path('uapprove', views.uapprove, name='uapprove'), + path('ulist', views.ulist, name='ulist'), +] diff --git a/server/views.py b/server/views.py new file mode 100644 index 0000000..ab94fd6 --- /dev/null +++ b/server/views.py @@ -0,0 +1,100 @@ +from django.shortcuts import render +from client.models import UserCode +from django.contrib.auth.models import Group, Permission, User + +# Create your views here. + + +def index(request): + context = {} + if (request.user.is_staff): + parent_group = request.user.groups.values_list('name', flat=True)[ + 0] + users = User.objects.filter(groups__name=parent_group) + out = [] + for user in users: + code = "" + if len(UserCode.objects.filter(user=user)) > 0: + code = 'U' + str(UserCode.objects.filter(user=user)[0].code) + status = "" + if user.is_staff: + status = "Capo" + elif user.has_perm("client.approved"): + status = "Attivo" + else: + status = "In attesa" + out.append([user.username, user.first_name, + user.last_name, code, status]) + context = {'users': out} + return render(request, 'server/index.html', context) + else: + return render(request, 'client/index.html', context) + + +def uapprove(request): + context = {} + if (request.user.is_staff): + if request.method == "POST": + parent_group = request.user.groups.values_list('name', flat=True)[ + 0] + group = Group.objects.get(name=parent_group) + permission = Permission.objects.get(codename='approved') + data = request.POST["codes"] + data += " " + data = data.split("\n") + for i in range(len(data)): + if not data[i].startswith("U"): + data[i] = data[i] + " - Formato errato" + elif not data[i][1:-1].isdigit(): + data[i] = data[i] + " - Formato errato" + elif int(data[i][1:-1]) < 100000 or int(data[i][1:-1]) > 999999: + data[i] = data[i] + " - Formato errato" + elif len(UserCode.objects.filter(code=data[i][1:-1])) == 0: + data[i] = data[i] + " - Invalido" + else: + user = UserCode.objects.filter(code=data[i][1:-1])[0].user + if len(user.groups.values_list('name', flat=True)) == 0: + user.groups.add(group) + user.user_permissions.add(permission) + data[i] = data[i] + " - Ok" + else: + if user.groups.values_list('name', flat=True)[0] == parent_group: + user.user_permissions.add(permission) + data[i] = data[i] + " - Gia` aggiunto" + else: + user.groups.clear() + user.groups.add(group) + user.user_permissions.add(permission) + data[i] = data[i] + " - Ok, cambio branca" + + context = {'messages': data} + + return render(request, 'server/approve_user.html', context) + else: + return render(request, 'client/index.html', context) + + +def ulist(request): + context = {} + if (request.user.is_staff): + parent_group = request.user.groups.values_list('name', flat=True)[ + 0] + users = User.objects.filter(groups__name=parent_group) + out = [] + for user in users: + code = "" + if len(UserCode.objects.filter(user=user)) > 0: + code = 'U' + str(UserCode.objects.filter(user=user)[0].code) + status = "" + if user.is_staff: + status = "Capo" + elif user.has_perm("approved"): + status = "Attivo" + else: + status = "In attesa" + out.append([user.username, user.first_name, + user.last_name, code, status]) + context = {'users': out} + return render(request, 'server/user_list.html', context) + else: + return render(request, 'client/index.html', context) diff --git a/templates/registration/base.html b/templates/registration/base.html new file mode 100644 index 0000000..51dad17 --- /dev/null +++ b/templates/registration/base.html @@ -0,0 +1,19 @@ + + + + + + + + {% block title %}Scout Brega{% endblock %} + + + {% block nav %} + {% endblock %} +
+ {% block content %} + {% endblock %} +
+ + + \ No newline at end of file diff --git a/templates/registration/login.html b/templates/registration/login.html new file mode 100644 index 0000000..71880b3 --- /dev/null +++ b/templates/registration/login.html @@ -0,0 +1,12 @@ +{% extends 'registration/base.html' %} + +{% block title %}Login{% endblock %} + +{% block content %} +

Login

+
+ {% csrf_token %} + {{ form.as_p }} + +
+{% endblock %} \ No newline at end of file -- cgit v1.2.1