Compare commits

...

28 Commits
main ... docker

Author SHA1 Message Date
Jochen Mehlich
0b84f73cbf model renaming applied
All checks were successful
Django Backend Validation / build (debian-latest, 3.10) (push) Successful in 2m55s
Django Backend Validation / build (debian-latest, 3.12) (push) Successful in 1m49s
Django Backend Validation / build (debian-latest, 3.11) (push) Successful in 1m52s
Django Backend Validation / build (ubuntu-latest, 3.10) (push) Successful in 19s
Django Backend Validation / build (ubuntu-latest, 3.11) (push) Successful in 18s
Django Backend Validation / build (ubuntu-latest, 3.12) (push) Successful in 14s
Signed-off-by: Jochen Mehlich <coding@jochenmehlich.de>
2024-09-03 16:30:04 +02:00
Jochen Mehlich
6cf3e6ef6b added person group model
All checks were successful
Django Backend Validation / build (debian-latest, 3.10) (push) Successful in 12s
Django Backend Validation / build (debian-latest, 3.11) (push) Successful in 12s
Django Backend Validation / build (debian-latest, 3.12) (push) Successful in 13s
Django Backend Validation / build (ubuntu-latest, 3.10) (push) Successful in 12s
Django Backend Validation / build (ubuntu-latest, 3.11) (push) Successful in 12s
Django Backend Validation / build (ubuntu-latest, 3.12) (push) Successful in 13s
Signed-off-by: Jochen Mehlich <coding@jochenmehlich.de>
2024-09-03 16:29:01 +02:00
Jochen Mehlich
c4fe55246b added person app
All checks were successful
Django Backend Validation / build (debian-latest, 3.10) (push) Successful in 29s
Django Backend Validation / build (debian-latest, 3.11) (push) Successful in 24s
Django Backend Validation / build (debian-latest, 3.12) (push) Successful in 19s
Django Backend Validation / build (ubuntu-latest, 3.10) (push) Successful in 12s
Django Backend Validation / build (ubuntu-latest, 3.11) (push) Successful in 12s
Django Backend Validation / build (ubuntu-latest, 3.12) (push) Successful in 13s
Signed-off-by: Jochen Mehlich <coding@jochenmehlich.de>
2024-09-03 16:24:44 +02:00
Jochen Mehlich
efc9b8e10b added simple registration form
All checks were successful
Django Backend Validation / build (debian-latest, 3.10) (push) Successful in 20s
Django Backend Validation / build (debian-latest, 3.11) (push) Successful in 21s
Django Backend Validation / build (debian-latest, 3.12) (push) Successful in 17s
Django Backend Validation / build (ubuntu-latest, 3.10) (push) Successful in 12s
Django Backend Validation / build (ubuntu-latest, 3.11) (push) Successful in 12s
Django Backend Validation / build (ubuntu-latest, 3.12) (push) Successful in 13s
Signed-off-by: Jochen Mehlich <coding@jochenmehlich.de>
2024-08-29 16:27:18 +02:00
Jochen Mehlich
a9d639db55 added logout functionality and updated login form validation
All checks were successful
Django Backend Validation / build (ubuntu-latest, 3.12) (push) Successful in 16s
Django Backend Validation / build (debian-latest, 3.11) (push) Successful in 20s
Django Backend Validation / build (debian-latest, 3.12) (push) Successful in 16s
Django Backend Validation / build (ubuntu-latest, 3.10) (push) Successful in 14s
Django Backend Validation / build (ubuntu-latest, 3.11) (push) Successful in 17s
Django Backend Validation / build (debian-latest, 3.10) (push) Successful in 17s
Signed-off-by: Jochen Mehlich <coding@jochenmehlich.de>
2024-08-28 16:05:24 +02:00
Jochen Mehlich
fd249adbbb added openid default setting field migration
All checks were successful
Django Backend Validation / build (debian-latest, 3.10) (push) Successful in 14s
Django Backend Validation / build (debian-latest, 3.11) (push) Successful in 15s
Django Backend Validation / build (debian-latest, 3.12) (push) Successful in 15s
Django Backend Validation / build (ubuntu-latest, 3.10) (push) Successful in 14s
Django Backend Validation / build (ubuntu-latest, 3.11) (push) Successful in 17s
Django Backend Validation / build (ubuntu-latest, 3.12) (push) Successful in 16s
Signed-off-by: Jochen Mehlich <coding@jochenmehlich.de>
2024-08-28 15:50:45 +02:00
Jochen Mehlich
c9ef27ea18 made parameter_name to pk
All checks were successful
Django Backend Validation / build (ubuntu-latest, 3.10) (push) Successful in 12s
Django Backend Validation / build (ubuntu-latest, 3.12) (push) Successful in 14s
Django Backend Validation / build (debian-latest, 3.10) (push) Successful in 13s
Django Backend Validation / build (ubuntu-latest, 3.11) (push) Successful in 14s
Django Backend Validation / build (debian-latest, 3.11) (push) Successful in 13s
Django Backend Validation / build (debian-latest, 3.12) (push) Successful in 13s
Signed-off-by: Jochen Mehlich <coding@jochenmehlich.de>
2024-08-28 15:29:49 +02:00
Jochen Mehlich
c5d42c4d57 added definition of settingsParameter
All checks were successful
Django Backend Validation / build (ubuntu-latest, 3.10) (push) Successful in 13s
Django Backend Validation / build (ubuntu-latest, 3.11) (push) Successful in 16s
Django Backend Validation / build (debian-latest, 3.10) (push) Successful in 15s
Django Backend Validation / build (debian-latest, 3.11) (push) Successful in 17s
Django Backend Validation / build (debian-latest, 3.12) (push) Successful in 17s
Django Backend Validation / build (ubuntu-latest, 3.12) (push) Successful in 15s
Signed-off-by: Jochen Mehlich <coding@jochenmehlich.de>
2024-08-28 15:28:37 +02:00
Jochen Mehlich
17e61ca66f added settings app
All checks were successful
Django Backend Validation / build (debian-latest, 3.11) (push) Successful in 15s
Django Backend Validation / build (debian-latest, 3.12) (push) Successful in 14s
Django Backend Validation / build (ubuntu-latest, 3.10) (push) Successful in 13s
Django Backend Validation / build (ubuntu-latest, 3.11) (push) Successful in 14s
Django Backend Validation / build (ubuntu-latest, 3.12) (push) Successful in 15s
Django Backend Validation / build (debian-latest, 3.10) (push) Successful in 13s
Signed-off-by: Jochen Mehlich <coding@jochenmehlich.de>
2024-08-28 15:19:06 +02:00
Jochen Mehlich
04d6cd0351 finished login openid button form
All checks were successful
Django Backend Validation / build (debian-latest, 3.11) (push) Successful in 19s
Django Backend Validation / build (debian-latest, 3.12) (push) Successful in 16s
Django Backend Validation / build (ubuntu-latest, 3.10) (push) Successful in 13s
Django Backend Validation / build (ubuntu-latest, 3.11) (push) Successful in 14s
Django Backend Validation / build (ubuntu-latest, 3.12) (push) Successful in 15s
Django Backend Validation / build (debian-latest, 3.10) (push) Successful in 14s
Signed-off-by: Jochen Mehlich <coding@jochenmehlich.de>
2024-08-28 15:14:21 +02:00
Jochen Mehlich
01300ba54a added login functionality
All checks were successful
Django Backend Validation / build (debian-latest, 3.10) (push) Successful in 13s
Django Backend Validation / build (debian-latest, 3.11) (push) Successful in 18s
Django Backend Validation / build (debian-latest, 3.12) (push) Successful in 16s
Django Backend Validation / build (ubuntu-latest, 3.12) (push) Successful in 15s
Django Backend Validation / build (ubuntu-latest, 3.10) (push) Successful in 14s
Django Backend Validation / build (ubuntu-latest, 3.11) (push) Successful in 14s
Signed-off-by: Jochen Mehlich <coding@jochenmehlich.de>
2024-08-28 14:53:37 +02:00
Jochen Mehlich
71549178ff added dev login form
All checks were successful
Django Backend Validation / build (debian-latest, 3.10) (push) Successful in 14s
Django Backend Validation / build (debian-latest, 3.11) (push) Successful in 17s
Django Backend Validation / build (debian-latest, 3.12) (push) Successful in 17s
Django Backend Validation / build (ubuntu-latest, 3.10) (push) Successful in 12s
Django Backend Validation / build (ubuntu-latest, 3.11) (push) Successful in 16s
Django Backend Validation / build (ubuntu-latest, 3.12) (push) Successful in 14s
Signed-off-by: Jochen Mehlich <coding@jochenmehlich.de>
2024-08-28 14:38:47 +02:00
Jochen Mehlich
6fdca30b98 removed unsuppoprted python version
All checks were successful
Django Backend Validation / build (debian-latest, 3.12) (push) Successful in 15s
Django Backend Validation / build (ubuntu-latest, 3.10) (push) Successful in 13s
Django Backend Validation / build (ubuntu-latest, 3.12) (push) Successful in 14s
Django Backend Validation / build (ubuntu-latest, 3.11) (push) Successful in 14s
Django Backend Validation / build (debian-latest, 3.10) (push) Successful in 12s
Django Backend Validation / build (debian-latest, 3.11) (push) Successful in 16s
Signed-off-by: Jochen Mehlich <coding@jochenmehlich.de>
2024-08-28 14:30:03 +02:00
Jochen Mehlich
ab18fa6624 cicd with more python versions
Some checks failed
Django Backend Validation / build (ubuntu-latest, 3.12) (push) Successful in 14s
Django Backend Validation / build (ubuntu-latest, 3.9) (push) Failing after 14s
Django Backend Validation / build (debian-latest, 3.10) (push) Successful in 49s
Django Backend Validation / build (debian-latest, 3.11) (push) Successful in 16s
Django Backend Validation / build (debian-latest, 3.12) (push) Successful in 16s
Django Backend Validation / build (debian-latest, 3.8) (push) Failing after 15s
Django Backend Validation / build (debian-latest, 3.9) (push) Failing after 15s
Django Backend Validation / build (ubuntu-latest, 3.10) (push) Successful in 13s
Django Backend Validation / build (ubuntu-latest, 3.11) (push) Successful in 15s
Django Backend Validation / build (ubuntu-latest, 3.8) (push) Failing after 14s
Signed-off-by: Jochen Mehlich <coding@jochenmehlich.de>
2024-08-28 14:26:24 +02:00
Jochen Mehlich
0ea875865d added first theme
All checks were successful
Django Backend Validation / build (debian-latest, 3.11) (push) Successful in 14s
Django Backend Validation / build (debian-latest, 3.12) (push) Successful in 14s
Django Backend Validation / build (ubuntu-latest, 3.11) (push) Successful in 13s
Django Backend Validation / build (ubuntu-latest, 3.12) (push) Successful in 14s
Signed-off-by: Jochen Mehlich <coding@jochenmehlich.de>
2024-08-28 14:24:58 +02:00
Jochen Mehlich
aa76bbf74b installed django-tailwind
All checks were successful
Django Backend Validation / build (debian-latest, 3.11) (push) Successful in 20s
Django Backend Validation / build (debian-latest, 3.12) (push) Successful in 20s
Django Backend Validation / build (ubuntu-latest, 3.11) (push) Successful in 13s
Django Backend Validation / build (ubuntu-latest, 3.12) (push) Successful in 13s
Signed-off-by: Jochen Mehlich <coding@jochenmehlich.de>
2024-08-28 14:15:32 +02:00
Jochen Mehlich
fd365ef3fb updated cicd settings (removed max parallel
All checks were successful
Django Backend Validation / build (debian-latest, 3.11) (push) Successful in 12s
Django Backend Validation / build (debian-latest, 3.12) (push) Successful in 13s
Django Backend Validation / build (ubuntu-latest, 3.11) (push) Successful in 12s
Django Backend Validation / build (ubuntu-latest, 3.12) (push) Successful in 12s
Signed-off-by: Jochen Mehlich <coding@jochenmehlich.de>
2024-08-28 14:10:17 +02:00
Jochen Mehlich
16f09b429a added tailwind
Some checks failed
Django Backend Validation / build (ubuntu-latest, 3.12) (push) Waiting to run
Django Backend Validation / build (ubuntu-latest, 3.11) (push) Waiting to run
Django Backend Validation / build (debian-latest, 3.11) (push) Successful in 13s
Django Backend Validation / build (debian-latest, 3.12) (push) Has been cancelled
Signed-off-by: Jochen Mehlich <coding@jochenmehlich.de>
2024-08-28 14:09:55 +02:00
Jochen Mehlich
178fca2458 updated gitignore
All checks were successful
Django Backend Validation / build (debian-latest, 3.11) (push) Successful in 15s
Django Backend Validation / build (debian-latest, 3.12) (push) Successful in 15s
Django Backend Validation / build (ubuntu-latest, 3.11) (push) Successful in 12s
Django Backend Validation / build (ubuntu-latest, 3.12) (push) Successful in 13s
Signed-off-by: Jochen Mehlich <coding@jochenmehlich.de>
2024-08-28 14:07:53 +02:00
Jochen Mehlich
15c8c12356 changed default django settings to german internalization
All checks were successful
Django Backend Validation / build (debian-latest, 3.11) (push) Successful in 12s
Django Backend Validation / build (debian-latest, 3.12) (push) Successful in 13s
Django Backend Validation / build (ubuntu-latest, 3.11) (push) Successful in 12s
Django Backend Validation / build (ubuntu-latest, 3.12) (push) Successful in 13s
Signed-off-by: Jochen Mehlich <coding@jochenmehlich.de>
2024-08-28 13:50:14 +02:00
Jochen Mehlich
fac00fc3a7 added additional ubuntu and debian versions
All checks were successful
Django Backend Validation / build (debian-latest, 3.11) (push) Successful in 11s
Django Backend Validation / build (debian-latest, 3.12) (push) Successful in 13s
Django Backend Validation / build (ubuntu-latest, 3.11) (push) Successful in 12s
Django Backend Validation / build (ubuntu-latest, 3.12) (push) Successful in 13s
Signed-off-by: Jochen Mehlich <coding@jochenmehlich.de>
2024-08-28 13:45:50 +02:00
Jochen Mehlich
72dd180cca added additional python versions for gitea actions
Some checks failed
Django Backend Validation / build (3.11) (push) Successful in 37s
Django Backend Validation / build (3.12) (push) Has been cancelled
Signed-off-by: Jochen Mehlich <coding@jochenmehlich.de>
2024-08-28 13:45:02 +02:00
Jochen Mehlich
8747a585fe added additional python versions for gitea actions
Some checks failed
Django Backend Validation / build (3.12) (push) Waiting to run
Django Backend Validation / build (3.1) (push) Failing after 9s
Django Backend Validation / build (3.11) (push) Has been cancelled
Signed-off-by: Jochen Mehlich <coding@jochenmehlich.de>
2024-08-28 13:44:37 +02:00
Jochen Mehlich
55a1ff6260 changed python version
All checks were successful
Django Backend Validation / build (3.12) (push) Successful in 42s
Signed-off-by: Jochen Mehlich <coding@jochenmehlich.de>
2024-08-28 13:43:44 +02:00
Jochen Mehlich
b701d75a50 added requirements.txt
Some checks failed
Django Backend Validation / build (3.7) (push) Failing after 19s
Django Backend Validation / build (3.8) (push) Failing after 12s
Django Backend Validation / build (3.9) (push) Failing after 20s
Signed-off-by: Jochen Mehlich <coding@jochenmehlich.de>
2024-08-28 13:42:23 +02:00
Jochen Mehlich
60e6db452c changed actions to default django
Some checks failed
Django Backend Validation / build (3.7) (push) Failing after 1m2s
Django Backend Validation / build (3.8) (push) Failing after 25s
Django Backend Validation / build (3.9) (push) Failing after 26s
Signed-off-by: Jochen Mehlich <coding@jochenmehlich.de>
2024-08-28 13:39:28 +02:00
Jochen Mehlich
284998f74e added cicdg
Signed-off-by: Jochen Mehlich <coding@jochenmehlich.de>
2024-08-28 13:39:18 +02:00
Jochen Mehlich
42c8efa1a6 added cicd
All checks were successful
Django Installation / setup-python-environment (push) Successful in 1m26s
Signed-off-by: Jochen Mehlich <coding@jochenmehlich.de>
2024-08-28 13:36:56 +02:00
45 changed files with 2078 additions and 4 deletions

View File

@ -0,0 +1,24 @@
name: Django Backend Validation
run-name: ${{ gitea.actor }} is running Django Tests
on: [push]
jobs:
build:
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
os: [ubuntu-latest, debian-latest]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Run Tests
run: |
python manage.py test

2
.gitignore vendored
View File

@ -20,6 +20,8 @@ media
# AWS User-specific
.idea/**/aws.xml
.idea/
# Generated files
.idea/**/contentModel.xml

0
person/__init__.py Normal file
View File

3
person/admin.py Normal file
View File

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

6
person/apps.py Normal file
View File

@ -0,0 +1,6 @@
from django.apps import AppConfig
class PersonConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'person'

View File

@ -0,0 +1,23 @@
# Generated by Django 5.1 on 2024-09-03 14:28
import uuid
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='quote_person_group',
fields=[
('label', models.CharField(max_length=255)),
('id', models.UUIDField(default=uuid.uuid4, editable=False, primary_key=True, serialize=False, unique=True)),
('description', models.TextField(null=True)),
],
),
]

View File

@ -0,0 +1,17 @@
# Generated by Django 5.1 on 2024-09-03 14:29
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('person', '0001_initial'),
]
operations = [
migrations.RenameModel(
old_name='quote_person_group',
new_name='QuotePersonGroup',
),
]

View File

7
person/models.py Normal file
View File

@ -0,0 +1,7 @@
from django.db import models
import uuid
# Create your models here.
class QuotePersonGroup(models.Model):
label = models.CharField(max_length=255, null=False, unique=False)
id = models.UUIDField(default=uuid.uuid4, editable = False, primary_key = True, unique = True)
description = models.TextField(null=True)

3
person/tests.py Normal file
View File

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

3
person/views.py Normal file
View File

@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.

0
quote/__init__.py Normal file
View File

3
quote/admin.py Normal file
View File

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

6
quote/apps.py Normal file
View File

@ -0,0 +1,6 @@
from django.apps import AppConfig
class QuoteConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'quote'

View File

3
quote/models.py Normal file
View File

@ -0,0 +1,3 @@
from django.db import models
# Create your models here.

3
quote/tests.py Normal file
View File

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

3
quote/views.py Normal file
View File

@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.

28
requirements.txt Normal file
View File

@ -0,0 +1,28 @@
arrow==1.3.0
asgiref==3.8.1
binaryornot==0.4.4
certifi==2024.7.4
chardet==5.2.0
charset-normalizer==3.3.2
click==8.1.7
cookiecutter==2.6.0
Django==5.1
django-browser-reload==1.15.0
django-tailwind==3.8.0
idna==3.8
Jinja2==3.1.4
markdown-it-py==3.0.0
MarkupSafe==2.1.5
mdurl==0.1.2
Pygments==2.18.0
python-dateutil==2.9.0.post0
python-slugify==8.0.4
PyYAML==6.0.2
requests==2.32.3
rich==13.8.0
six==1.16.0
sqlparse==0.5.1
text-unidecode==1.3
types-python-dateutil==2.9.0.20240821
urllib3==2.2.2
uuid==1.30

0
settings/__init__.py Normal file
View File

3
settings/admin.py Normal file
View File

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

6
settings/apps.py Normal file
View File

@ -0,0 +1,6 @@
from django.apps import AppConfig
class SettingsConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'settings'

View File

@ -0,0 +1,23 @@
# Generated by Django 5.1 on 2024-08-28 13:28
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='settingsParameter',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('parameter_name', models.CharField(max_length=255, unique=True)),
('parameter_value', models.CharField(max_length=255)),
('parameter_class', models.CharField(blank=True, max_length=255)),
],
),
]

View File

@ -0,0 +1,22 @@
# Generated by Django 5.1 on 2024-08-28 13:29
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('settings', '0001_initial'),
]
operations = [
migrations.RemoveField(
model_name='settingsparameter',
name='id',
),
migrations.AlterField(
model_name='settingsparameter',
name='parameter_name',
field=models.CharField(max_length=255, primary_key=True, serialize=False, unique=True),
),
]

View File

@ -0,0 +1,47 @@
from django.db import migrations, models
from settings.models import settingsParameter
preloadData = [
{
"name": "openid_client_id",
"value": "",
"category": "openid"
},{
"name": "openid_client_secret",
"value": "",
"category": "openid"
},{
"name": "openid_autodiscoveryurl",
"value": "",
"category": "openid"
},{
"name": "openid_scopes",
"value": "",
"category": "openid"
},{
"name": "openid_group_attribute",
"value": "",
"category": "openid"
},{
"name": "openid_admin_group_name",
"value": "",
"category": "openid"
}
]
def create_datafields(apps, database_schema):
for datapoint in preloadData:
se = settingsParameter()
se.parameter_name = datapoint["name"]
se.parameter_value = datapoint["value"]
se.parameter_class = datapoint["category"]
se.save()
class Migration(migrations.Migration):
dependencies = [
('settings', '0002_remove_settingsparameter_id_and_more'),
]
operations = [
migrations.RunPython(create_datafields),
]

View File

7
settings/models.py Normal file
View File

@ -0,0 +1,7 @@
from django.db import models
# Create your models here.
class settingsParameter(models.Model):
parameter_name = models.CharField(max_length=255, unique=True, blank=False, primary_key=True)
parameter_value = models.CharField(max_length=255, blank=False)
parameter_class = models.CharField(max_length=255, blank=True)

3
settings/tests.py Normal file
View File

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

6
settings/urls.py Normal file
View File

@ -0,0 +1,6 @@
from django.urls import path
from . import views
urlpatterns = [
path('', views.home, name="home"),
]

7
settings/views.py Normal file
View File

@ -0,0 +1,7 @@
from django.http import HttpResponse
from django.shortcuts import render
# Create your views here.
def home(request):
return HttpResponse('')

0
theme/__init__.py Normal file
View File

5
theme/apps.py Normal file
View File

@ -0,0 +1,5 @@
from django.apps import AppConfig
class ThemeConfig(AppConfig):
name = 'theme'

1
theme/static_src/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
node_modules

1537
theme/static_src/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,28 @@
{
"name": "theme",
"version": "3.8.0",
"description": "",
"scripts": {
"start": "npm run dev",
"build": "npm run build:clean && npm run build:tailwind",
"build:clean": "rimraf ../static/css/dist",
"build:tailwind": "cross-env NODE_ENV=production tailwindcss --postcss -i ./src/styles.css -o ../static/css/dist/styles.css --minify",
"dev": "cross-env NODE_ENV=development tailwindcss --postcss -i ./src/styles.css -o ../static/css/dist/styles.css -w",
"tailwindcss": "node ./node_modules/tailwindcss/lib/cli.js"
},
"keywords": [],
"author": "",
"license": "MIT",
"devDependencies": {
"@tailwindcss/aspect-ratio": "^0.4.2",
"@tailwindcss/forms": "^0.5.7",
"@tailwindcss/typography": "^0.5.10",
"cross-env": "^7.0.3",
"postcss": "^8.4.32",
"postcss-import": "^15.1.0",
"postcss-nested": "^6.0.1",
"postcss-simple-vars": "^7.0.1",
"rimraf": "^5.0.5",
"tailwindcss": "^3.4.0"
}
}

View File

@ -0,0 +1,7 @@
module.exports = {
plugins: {
"postcss-import": {},
"postcss-simple-vars": {},
"postcss-nested": {}
},
}

View File

@ -0,0 +1,3 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

View File

@ -0,0 +1,57 @@
/**
* This is a minimal config.
*
* If you need the full config, get it from here:
* https://unpkg.com/browse/tailwindcss@latest/stubs/defaultConfig.stub.js
*/
module.exports = {
content: [
/**
* HTML. Paths to Django template files that will contain Tailwind CSS classes.
*/
/* Templates within theme app (<tailwind_app_name>/templates), e.g. base.html. */
'../templates/**/*.html',
/*
* Main templates directory of the project (BASE_DIR/templates).
* Adjust the following line to match your project structure.
*/
'../../templates/**/*.html',
/*
* Templates in other django apps (BASE_DIR/<any_app_name>/templates).
* Adjust the following line to match your project structure.
*/
'../../**/templates/**/*.html',
/**
* JS: If you use Tailwind CSS in JavaScript, uncomment the following lines and make sure
* patterns match your project structure.
*/
/* JS 1: Ignore any JavaScript in node_modules folder. */
// '!../../**/node_modules',
/* JS 2: Process all JavaScript files in the project. */
// '../../**/*.js',
/**
* Python: If you use Tailwind CSS classes in Python, uncomment the following line
* and make sure the pattern below matches your project structure.
*/
// '../../**/*.py'
],
theme: {
extend: {},
},
plugins: [
/**
* '@tailwindcss/forms' is the forms plugin that provides a minimal styling
* for forms. If you don't like it or have own styling for forms,
* comment the line below to disable '@tailwindcss/forms'.
*/
require('@tailwindcss/forms'),
require('@tailwindcss/typography'),
require('@tailwindcss/aspect-ratio'),
],
}

18
theme/templates/base.html Normal file
View File

@ -0,0 +1,18 @@
{% load static tailwind_tags %}
<!DOCTYPE html>
<html lang="de">
<head>
<title>Zitate</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
{% tailwind_css %}
</head>
<body class="bg-gray-50 dark:bg-gray-900 dark:text-white-90">
<div class="container mx-auto">
{% block content %}
{% endblock content %}
</div>
</body>
</html>

View File

@ -0,0 +1,45 @@
{%extends "base.html" %}
{% block content %}
<section class="bg-gray-50 dark:bg-gray-900">
<div class="flex flex-col items-center justify-center px-6 py-8 mx-auto md:h-screen lg:py-0">
<div class="w-full bg-white rounded-lg shadow dark:border md:mt-0 sm:max-w-md xl:p-0 dark:bg-gray-800 dark:border-gray-700">
<div class="p-6 space-y-4 md:space-y-6 sm:p-8">
<h1 class="text-xl font-bold leading-tight tracking-tight text-gray-900 md:text-2xl dark:text-white">
Sign in to your account
</h1>
<form class="space-y-4 md:space-y-6" method="post">
<input type="hidden" name="auth_type" value="form">
{% csrf_token %}
<div>
<label for="username" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Your username</label>
<input type="text" name="username" id="username" class="bg-gray-50 border border-gray-300 text-gray-900 rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="fooboar" required="">
</div>
<div>
<label for="password" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Password</label>
<input type="password" name="password" id="password" placeholder="••••••••" class="bg-gray-50 border border-gray-300 text-gray-900 rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" required="">
</div>
<button type="submit" class="w-full inline-flex items-center justify-center p-0.5 me-2 overflow-hidden text-sm font-medium text-gray-900 rounded-lg group bg-gradient-to-br from-purple-600 to-blue-500 group-hover:from-purple-600 group-hover:to-blue-500 hover:text-white dark:text-white focus:ring-4 focus:outline-none focus:ring-blue-300 dark:focus:ring-blue-800">
<span class="w-full px-5 py-2.5 transition-all ease-in duration-75 bg-white dark:bg-gray-900 rounded-md group-hover:bg-opacity-0">
Login
</span>
</button>
</form>
<form class="md:space-y-6" method="post">
<input type="hidden" name="auth_type" value="openid">
{% csrf_token %}
<div class="inline-flex items-center justify-center w-full">
<hr class="w-64 h-px my-8 bg-gray-200 border-0 dark:bg-gray-700">
<span class="absolute px-3 font-medium text-gray-900 -translate-x-1/2 bg-white left-1/2 dark:text-white dark:bg-gray-800">or</span>
</div>
<button class="w-full inline-flex items-center justify-center p-0.5 mb-2 me-2 overflow-hidden text-sm font-medium text-gray-900 rounded-lg group bg-gradient-to-br from-purple-600 to-blue-500 group-hover:from-purple-600 group-hover:to-blue-500 hover:text-white dark:text-white focus:ring-4 focus:outline-none focus:ring-blue-300 dark:focus:ring-blue-800">
<span class="w-full px-5 py-2.5 transition-all ease-in duration-75 bg-white dark:bg-gray-900 rounded-md group-hover:bg-opacity-0">
Login with StuVe SSO
</span>
</button>
</form>
</div>
</div>
</div>
</section>
{% endblock content %}

View File

@ -0,0 +1,36 @@
{%extends "base.html" %}
{% block content %}
<section class="bg-gray-50 dark:bg-gray-900">
<div class="flex flex-col items-center justify-center px-6 py-8 mx-auto md:h-screen lg:py-0">
<div class="w-full bg-white rounded-lg shadow dark:border md:mt-0 sm:max-w-md xl:p-0 dark:bg-gray-800 dark:border-gray-700">
<div class="p-6 space-y-4 md:space-y-6 sm:p-8">
<h1 class="text-xl font-bold leading-tight tracking-tight text-gray-900 md:text-2xl dark:text-white">
Create your account
</h1>
<form class="space-y-4 md:space-y-6" method="post">
<input type="hidden" name="auth_type" value="form">
{% csrf_token %}
<div>
<label for="username" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Your username</label>
<input type="text" name="username" id="username" class="bg-gray-50 border border-gray-300 text-gray-900 rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="fooboar" required="">
</div>
<div>
<label for="email" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Your email</label>
<input type="email" name="email" id="email" class="bg-gray-50 border border-gray-300 text-gray-900 rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" placeholder="foo@bar.it" required="">
</div>
<div>
<label for="password" class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Password</label>
<input type="password" name="password" id="password" placeholder="••••••••" class="bg-gray-50 border border-gray-300 text-gray-900 rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500" required="">
</div>
<button type="submit" class="w-full inline-flex items-center justify-center p-0.5 me-2 overflow-hidden text-sm font-medium text-gray-900 rounded-lg group bg-gradient-to-br from-purple-600 to-blue-500 group-hover:from-purple-600 group-hover:to-blue-500 hover:text-white dark:text-white focus:ring-4 focus:outline-none focus:ring-blue-300 dark:focus:ring-blue-800">
<span class="w-full px-5 py-2.5 transition-all ease-in duration-75 bg-white dark:bg-gray-900 rounded-md group-hover:bg-opacity-0">
Signup
</span>
</button>
</form>
</div>
</div>
</div>
</section>
{% endblock content %}

13
zitate/forms.py Normal file
View File

@ -0,0 +1,13 @@
from django import forms
from django.contrib.auth.models import User
class LoginForm(forms.Form):
username = forms.CharField(label="username", max_length=255)
password = forms.CharField(label="password", max_length=255, widget=forms.PasswordInput)
auth_type = forms.CharField(label="auth_type", max_length=255)
class RegisterForm(forms.Form):
username = forms.CharField(label="username", max_length=255)
password = forms.CharField(label="password", max_length=255, widget=forms.PasswordInput)
email = forms.CharField(label="email", max_length=255)

View File

@ -37,6 +37,11 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'tailwind',
'theme',
'django_browser_reload',
'settings',
'person',
]
MIDDLEWARE = [
@ -47,6 +52,7 @@ MIDDLEWARE = [
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
"django_browser_reload.middleware.BrowserReloadMiddleware",
]
ROOT_URLCONF = 'zitate.urls'
@ -54,7 +60,7 @@ ROOT_URLCONF = 'zitate.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'DIRS': [BASE_DIR / 'theme'],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
@ -103,9 +109,9 @@ AUTH_PASSWORD_VALIDATORS = [
# Internationalization
# https://docs.djangoproject.com/en/4.2/topics/i18n/
LANGUAGE_CODE = 'en-us'
LANGUAGE_CODE = 'de-de'
TIME_ZONE = 'UTC'
TIME_ZONE = 'Europe/Berlin'
USE_I18N = True
@ -121,3 +127,9 @@ STATIC_URL = 'static/'
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
TAILWIND_APP_NAME = 'theme'
INTERNAL_IPS = [
"127.0.0.1",
]

View File

@ -15,8 +15,14 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
from django.urls import path, include
from .views import *
urlpatterns = [
path('admin/', admin.site.urls),
path("__reload__/", include("django_browser_reload.urls")),
path("login", login, name="login"),
path("register", register, name="register"),
path("logout", logout, name="logout"),
path("settings/", include('settings.urls')),
]

48
zitate/views.py Normal file
View File

@ -0,0 +1,48 @@
from django.shortcuts import render
import django.contrib.auth as dauth
from django.shortcuts import redirect
from django.contrib.auth.models import User
from zitate.forms import LoginForm, RegisterForm
def login(request):
if request.method == "GET":
return render(request, "login.html")
elif request.method == "POST":
form = LoginForm(request.POST)
auth_type = request.POST.get("auth_type")
if auth_type == "form":
if form.is_valid():
username = form.cleaned_data["username"]
password = form.cleaned_data["password"]
user = dauth.authenticate(request, username=username, password=password)
if user is not None:
dauth.login(request, user)
return redirect("/")
else:
return render(request, "login.html", {"userError": True})
elif auth_type == "openid":
return render(request, "login.html")
def register(request):
if request.method == "GET":
return render(request, "register.html")
elif request.method == "POST":
form = RegisterForm(request.POST)
if form.is_valid():
username = form.cleaned_data["username"]
password = form.cleaned_data["password"]
email = form.cleaned_data["email"]
User.objects.create_user(username, email, password)
user = dauth.authenticate(request, username=username, password=password)
if user is not None:
dauth.login(request, user)
return redirect("/")
else:
return render(request, "register.html", {"userError": True})
def logout(request):
dauth.logout(request)
return redirect("/")