Compare commits
90 Commits
feature_5_
...
51-im-impr
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
69dc2530ce | ||
|
|
e0bfda0dee | ||
|
|
23675bc69e | ||
|
|
94659791e6 | ||
|
|
17cc0af02d | ||
|
|
f28878e1b0 | ||
|
|
2a8b0b813c | ||
|
|
f18ed83f9d | ||
|
|
d1cca38595 | ||
|
|
1f1344522f | ||
|
|
7cad46063e | ||
|
|
55750bcf1f | ||
|
|
230944cbcd | ||
|
|
2f47ff8523 | ||
|
|
3ef7d61da6 | ||
|
|
7fe29c5bd4 | ||
|
|
5775e53bb8 | ||
|
|
57682d4607 | ||
|
|
915552ac4a | ||
| 861e89ae4d | |||
| 97fd326561 | |||
|
|
34a9ab6a43 | ||
|
|
4c597473b7 | ||
|
|
8119f202d3 | ||
| 6beccc772a | |||
|
|
4797a74111 | ||
|
|
30b5cd9731 | ||
|
|
6b83f26fc0 | ||
|
|
346ac69046 | ||
|
|
838eaab9be | ||
|
|
eba34fa2d4 | ||
|
|
9f51def959 | ||
| c8bf38dd36 | |||
|
|
7120dcd317 | ||
|
|
da419533e9 | ||
|
|
bd0aa651af | ||
|
|
d1b11a0c51 | ||
|
|
5dc849f551 | ||
| 35617470c4 | |||
|
|
b6991c2cbd | ||
|
|
a0e31d77f2 | ||
|
|
434d1f63e3 | ||
|
|
e3bd3c8579 | ||
|
|
7e66868a7d | ||
|
|
b306321565 | ||
|
|
3a099945b5 | ||
|
|
9f6c1cc33c | ||
|
|
13cbaaa6dc | ||
|
|
46634b1e1c | ||
|
|
3508b8e341 | ||
|
|
039e3ea0cb | ||
| 90d7a3ea94 | |||
| c348734ff4 | |||
| 35da688b1e | |||
|
|
089abfc598 | ||
| f732d8305e | |||
|
|
7a4caf7191 | ||
| 213b4cfd77 | |||
|
|
1f55ad8247 | ||
|
|
53ffe3822a | ||
|
|
71d8deab5b | ||
|
|
2173d7f928 | ||
|
|
eddab4a298 | ||
|
|
2ea2c03c67 | ||
|
|
0775710102 | ||
|
|
ba77d72091 | ||
|
|
47beb3a8e7 | ||
|
|
0eaac8c2f0 | ||
| 266cf4dbba | |||
| 5a63584a17 | |||
|
|
37ffbebc67 | ||
| 9fdbaf7b23 | |||
|
|
adb208a56a | ||
| e09410d38a | |||
|
|
9e510fa090 | ||
|
|
c0ade602b5 | ||
| 9e3317274f | |||
| 16f489c91b | |||
|
|
fa260ee4ff | ||
|
|
cc6ace3798 | ||
|
|
4d213db5c9 | ||
|
|
44822b9a11 | ||
|
|
7a59998cff | ||
|
|
83335fd07a | ||
| 7113cc197f | |||
| d8fcfeb0c0 | |||
|
|
31cc63250c | ||
|
|
53c2a13923 | ||
| 4afeb40dca | |||
| 27274582c5 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -2,3 +2,5 @@ __pycache__
|
||||
.venv
|
||||
db.sqlite3
|
||||
tailwindcss.exe
|
||||
t-style.css
|
||||
dump.rdb
|
||||
21
README.md
21
README.md
@@ -6,6 +6,7 @@
|
||||
2. [Starten des Servers](#starten-des-servers)
|
||||
3. [Superuser erstellen](#superuser-erstellen)
|
||||
4. [Tailwind-Nutzung](#tailwind-nutzung)
|
||||
5. [Issue - Merge Request - Merge](#issue-mergerequest-merge)
|
||||
|
||||
## Initialisierung des Projekts
|
||||
|
||||
@@ -83,7 +84,11 @@ npm install tailwindcss @tailwindcss/cli
|
||||
### Datei generieren
|
||||
|
||||
```sh
|
||||
# Bei Verwendung der Binärdatei:
|
||||
tailwindcss -i <INPUT-DATEI> -o <OUTPUT-DATEI> --watch --minify
|
||||
|
||||
# Bei Verwendung von NPM:
|
||||
npx @tailwindcss/cli -i <INPUT-DATEI> -o <OUTPUT-DATEI> --watch --minify
|
||||
```
|
||||
|
||||
- INPUT-DATEI: CSS Datei, welche die Einbindung und Konfiguration von Tailwind enthält
|
||||
@@ -94,5 +99,19 @@ tailwindcss -i <INPUT-DATEI> -o <OUTPUT-DATEI> --watch --minify
|
||||
**Beispiel:**
|
||||
|
||||
```sh
|
||||
tailwindcss -i core/homepage/static/homepage/t-input.css -o core/homepage/static/homepage/t-style.css --watch --minify
|
||||
# unter Linux mit Tailwind Binärdatei:
|
||||
tailwindcss -i core/static/homepage/t-input.css -o core/static/homepage/t-style.css --watch --minify
|
||||
|
||||
# unter Windows mit NPM:
|
||||
npx @tailwindcss/cli -i .\core\static\homepage\t-input.css -o .\core\static\homepage\t-style.css --watch --minify
|
||||
```
|
||||
|
||||
## Issue - Merge Request - Merge
|
||||
|
||||
Hier der vereinbarte Arbeitsablauf:
|
||||
|
||||
1. Issue erstellen - das geht am einfachsten über die Webseite. Der Titel beschreibt kurz und klar, was angestrebt wird.
|
||||
|
||||
2. Merge Request anlegen - dadurch wird der Bransch automatisch angelegt. Dieser kann mit `git pull` geholt und mit `git checkout <branch>` bearbeitet werden.
|
||||
|
||||
3. Nach dem Hochladen kann der Merge in den Master durchgeführt werden.
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
/*color vars*/
|
||||
:root {
|
||||
--main_bg: #1e1e1e;
|
||||
--main_text_color: #d3d3d3;
|
||||
--main_color: #3399cc;
|
||||
--hover_main_color: #3399ccb0;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
body {
|
||||
background-color: var(--main_bg);
|
||||
color: var(--main_text_color);
|
||||
font-family: Arial, sans-serif;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
margin: 0;
|
||||
}
|
||||
@@ -1,128 +0,0 @@
|
||||
|
||||
.register_link {
|
||||
color:var(--main_text_color);
|
||||
background-color: #2e2e2e;
|
||||
}
|
||||
|
||||
.register_button {
|
||||
color:var(--main_text_color);
|
||||
background-color: #2e2e2e;
|
||||
border-radius: 5px;
|
||||
border:none;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.login-container {
|
||||
background-color: #2e2e2e;
|
||||
padding: 30px;
|
||||
border-radius: 15px;
|
||||
width: 400px;
|
||||
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.5);
|
||||
text-align: center;
|
||||
border: 2px solid var(--main_color);
|
||||
}
|
||||
|
||||
.login-header {
|
||||
color: var(--main_text_color);
|
||||
font-size: 24px;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
|
||||
.input-group {
|
||||
width: 350px;
|
||||
margin-bottom: 15px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding-left: 25px;
|
||||
padding-right: 25px;
|
||||
}
|
||||
|
||||
|
||||
.input-group input {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
border: 1px solid #555;
|
||||
border-radius: 15px;
|
||||
background-color: #4a4a4a;
|
||||
color: var(--main_text_color);
|
||||
outline: none;
|
||||
transition: transform 0.2s ease;
|
||||
}
|
||||
|
||||
|
||||
.input-group input:focus {
|
||||
transform: scale(1.06);
|
||||
border-color: var(--main_color);
|
||||
}
|
||||
|
||||
|
||||
.login-button {
|
||||
width: 50%;
|
||||
padding: 13px;
|
||||
background-color: var(--main_color);
|
||||
color: var(--main_text_color);
|
||||
border: none;
|
||||
border-radius: 15px;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.3s ease;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
margin-top: 10px;
|
||||
transition: transform 0.2s ease;
|
||||
}
|
||||
|
||||
|
||||
.login-button:hover {
|
||||
background-color: var(--hover_main_color);
|
||||
transform: scale(1.06);
|
||||
}
|
||||
|
||||
|
||||
.login-logo {
|
||||
width: 400px;
|
||||
height: auto;
|
||||
margin-bottom: 20px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
border-radius: 10px;
|
||||
}
|
||||
.login-logo-mobile {
|
||||
width: 150px;
|
||||
}
|
||||
|
||||
|
||||
.login-container {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* MOBILE DEVICES */
|
||||
@media (max-width: 768px) {
|
||||
.login-container {
|
||||
width: 250px;
|
||||
padding: 10px;
|
||||
}
|
||||
.input-group {
|
||||
width: 200px;
|
||||
}
|
||||
.login-logo {
|
||||
display:none;
|
||||
}
|
||||
.login-button {
|
||||
height: auto;
|
||||
}
|
||||
.login-form {
|
||||
padding-bottom: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
/* DESKTOP DEVICES*/
|
||||
@media (min-width: 768px) {
|
||||
.login-logo-mobile {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
{% load static %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{% block title %}{% endblock %}</title>
|
||||
<link rel="stylesheet" href="{% static 'homepage/t-style.css' %}">
|
||||
</head>
|
||||
<body>
|
||||
{% include 'homepage/partials/_nav.html' %}
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
{% include 'homepage/partials/_footer.html' %}
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,11 +0,0 @@
|
||||
{% extends 'accounts/base.html'%}
|
||||
{% block title %}Home{% endblock %}
|
||||
{% block content %}
|
||||
<div class="grid place-content-center h-120">
|
||||
<h1 class="text-center m-4 text-6xl">Moin moin!</h1>
|
||||
<form action="{% url 'accounts:logout' %}" method="post">
|
||||
{% csrf_token %}
|
||||
<button class="bg-red-600 text-white p-3 rounded-full font-black" type="submit">Abmelden</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -1,12 +0,0 @@
|
||||
<nav class="flex justify-between bg-blue-600 h-12 px-4 sm:px-6 lg:px-8 rounded-lg m-2 shadow-md">
|
||||
<div class="flex items-center">
|
||||
<h2 class="text-xl font-bold text-white hover:scale-110 transition duration-200"><a href="#">qivip</a></h2>
|
||||
</div>
|
||||
<div class="flex items-center">
|
||||
<ul class="flex space-x-4 qp-nav-list">
|
||||
<li><a href="#">Start</a></li>
|
||||
<li><a href="#">Bibliothek</a></li>
|
||||
<li><a href="{% url 'login' %}">Konto</a></li> <!--Hier ist der Link erstmal auf das alte Login-Formular gesetzt! Zum Testen!-->
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,15 +0,0 @@
|
||||
{% load static %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="{% static 'homepage/t-style.css' %}">
|
||||
<title>qivip</title>
|
||||
</head>
|
||||
<body>
|
||||
{% include 'homepage/partials/_nav.html' %}
|
||||
{% block content%}{% endblock %}
|
||||
{% include 'homepage/partials/_footer.html' %}
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,7 +0,0 @@
|
||||
<div class="grid place-content-center gap-2 w-full mt-4">
|
||||
<div class="flex space-x-2 pb-4">
|
||||
<p class="text-sm font-extralight"><a href="#">Impressum</a></p>
|
||||
<p class="text-sm font-extralight"><a href="#">Datenschutz</a></p>
|
||||
<p class="text-sm font-extralight"><a href="#">Repository</a></p>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,4 +0,0 @@
|
||||
from django.shortcuts import render, redirect
|
||||
|
||||
def home(request):
|
||||
return render(request, 'homepage/home.html')
|
||||
@@ -1,18 +0,0 @@
|
||||
{% load static %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="{% static 'homepage/t-style.css' %}">
|
||||
<title>qivip</title>
|
||||
</head>
|
||||
<body>
|
||||
{% include 'homepage/partials/_nav.html' %}
|
||||
<div class="max-w-screen-lg mx-auto">
|
||||
{% block content%}{% endblock %}
|
||||
</div>
|
||||
{% include 'homepage/partials/_footer.html' %}
|
||||
{% block extra_js %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,19 +0,0 @@
|
||||
{% extends 'library/base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Übersicht</h1>
|
||||
<div class="flex justify-end">
|
||||
<a href="{% url 'library:new_quiz' %}" class="bg-blue-500 text-white px-4 py-2 rounded-md">Neues Quiz erstellen</a>
|
||||
</div>
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4">
|
||||
{% for quiz in quizzes %}
|
||||
<div class="bg-white rounded-lg p-4 shadow-md">
|
||||
<h2 class="text-lg font-bold"><a href="{% url 'library:detail_quiz' quiz.id %}">{{ quiz.name }}</a></h2>
|
||||
<p class="text-sm text-gray-600">{{ quiz.description }}</p>
|
||||
<a href="#">Spiel starten</a>
|
||||
<a href="{% url 'library:edit_quiz' quiz.id %}">Bearbeiten</a>
|
||||
<a href="{% url 'library:delete_quiz' quiz.id %}">Löschen</a>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -35,6 +35,7 @@ INSTALLED_APPS = [
|
||||
'homepage.apps.HomepageConfig',
|
||||
'components.apps.ComponentsConfig',
|
||||
'accounts.apps.AccountsConfig',
|
||||
'play',
|
||||
'django.contrib.admin',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
@@ -58,7 +59,7 @@ ROOT_URLCONF = 'core.urls'
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [],
|
||||
'DIRS': [BASE_DIR / 'templates'],
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
@@ -120,11 +121,11 @@ USE_TZ = True
|
||||
# https://docs.djangoproject.com/en/5.1/howto/static-files/
|
||||
|
||||
STATIC_URL = '/static/'
|
||||
BASE_DIR='static' #von ben8 hinzugefügt
|
||||
STATICFILES_DIRS = [BASE_DIR / 'static']
|
||||
|
||||
# Default primary key field type
|
||||
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field
|
||||
|
||||
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
|
||||
|
||||
LOGIN_URL = '/login/'
|
||||
LOGIN_URL = '/account/login/'
|
||||
@@ -21,6 +21,6 @@ urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
path('account/', include('accounts.urls')),
|
||||
path('', include('homepage.urls')),
|
||||
path('play/', include('components.urls')),
|
||||
path('play/', include('play.urls')),
|
||||
path('library/', include('library.urls')),
|
||||
]
|
||||
@@ -5,4 +5,6 @@ app_name = 'homepage' # Verhindert Konflikt mit anderen Apps
|
||||
|
||||
urlpatterns = [
|
||||
path('', views.home, name="home"),
|
||||
path('impress', views.impress, name="impress"),
|
||||
path('privacy', views.privacy, name="privacy"),
|
||||
]
|
||||
9
django/homepage/views.py
Normal file
9
django/homepage/views.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from django.shortcuts import render, redirect
|
||||
|
||||
def home(request):
|
||||
return render(request, 'homepage/home.html')
|
||||
|
||||
def impress(request):
|
||||
return render(request, 'homepage/impress.html')
|
||||
def privacy(request):
|
||||
return render(request, 'homepage/privacy.html')
|
||||
@@ -4,7 +4,7 @@ from .models import QivipQuiz, QivipQuestion
|
||||
class QuizForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = QivipQuiz
|
||||
fields = ['name', 'description', 'status', 'category', 'tags']
|
||||
fields = ['name', 'description', 'status', 'category', 'tags',"difficulty"]
|
||||
|
||||
class QuestionForm(forms.ModelForm):
|
||||
class Meta:
|
||||
18
django/library/migrations/0002_alter_qivipquiz_status.py
Normal file
18
django/library/migrations/0002_alter_qivipquiz_status.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.1.3 on 2025-03-08 13:14
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('library', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='qivipquiz',
|
||||
name='status',
|
||||
field=models.CharField(choices=[('public', 'Öffentlich'), ('hidden', 'Versteckt'), ('private', 'Privat')], default='private', max_length=10),
|
||||
),
|
||||
]
|
||||
18
django/library/migrations/0003_alter_qivipquiz_status.py
Normal file
18
django/library/migrations/0003_alter_qivipquiz_status.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.1.3 on 2025-03-08 13:16
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('library', '0002_alter_qivipquiz_status'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='qivipquiz',
|
||||
name='status',
|
||||
field=models.CharField(choices=[('public', 'Öffentlich'), ('hidden', 'Versteckt'), ('private', 'Privat')], default='Privat', max_length=10),
|
||||
),
|
||||
]
|
||||
18
django/library/migrations/0004_alter_qivipquiz_status.py
Normal file
18
django/library/migrations/0004_alter_qivipquiz_status.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.1.3 on 2025-03-08 13:18
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('library', '0003_alter_qivipquiz_status'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='qivipquiz',
|
||||
name='status',
|
||||
field=models.CharField(choices=[('public', 'Öffentlich'), ('hidden', 'Versteckt'), ('private', 'Privat')], default='private', max_length=10),
|
||||
),
|
||||
]
|
||||
18
django/library/migrations/0005_alter_qivipquiz_status.py
Normal file
18
django/library/migrations/0005_alter_qivipquiz_status.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.1.3 on 2025-03-08 13:23
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('library', '0004_alter_qivipquiz_status'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='qivipquiz',
|
||||
name='status',
|
||||
field=models.CharField(choices=[('public', 'Öffentlich'), ('hidden', 'Versteckt'), ('private', 'Privat')], default='public', max_length=10),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.1.3 on 2025-03-08 13:30
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('library', '0005_alter_qivipquiz_status'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='qivipquiz',
|
||||
name='description',
|
||||
field=models.TextField(blank=True, default='In dem Quiz geht es um ...', null=True),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.1.3 on 2025-03-08 13:31
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('library', '0006_alter_qivipquiz_description'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='qivipquiz',
|
||||
name='description',
|
||||
field=models.TextField(blank=True, default='Das Quiz ist ein ... Quiz. In dem Quiz geht es um ...', null=True),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.1.3 on 2025-03-08 13:32
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('library', '0007_alter_qivipquiz_description'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='qivipquiz',
|
||||
name='description',
|
||||
field=models.TextField(blank=True, default='Das Quiz ist ein ... Quiz. \n In dem Quiz geht es um ...', null=True),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.1.3 on 2025-03-08 13:32
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('library', '0008_alter_qivipquiz_description'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='qivipquiz',
|
||||
name='description',
|
||||
field=models.TextField(blank=True, default='Das Quiz ist ein ... Quiz. \nIn dem Quiz geht es um ...', null=True),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.1.3 on 2025-03-08 13:33
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('library', '0009_alter_qivipquiz_description'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='qivipquiz',
|
||||
name='description',
|
||||
field=models.TextField(blank=True, default='In dem Quiz geht es um ...', null=True),
|
||||
),
|
||||
]
|
||||
18
django/library/migrations/0011_qivipquiz_difficulty.py
Normal file
18
django/library/migrations/0011_qivipquiz_difficulty.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.1.3 on 2025-03-08 13:37
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('library', '0010_alter_qivipquiz_description'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='qivipquiz',
|
||||
name='difficulty',
|
||||
field=models.CharField(choices=[('public', 'Öffentlich'), ('hidden', 'Versteckt'), ('private', 'Privat')], default='public', max_length=10),
|
||||
),
|
||||
]
|
||||
18
django/library/migrations/0012_alter_qivipquiz_difficulty.py
Normal file
18
django/library/migrations/0012_alter_qivipquiz_difficulty.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.1.3 on 2025-03-08 13:39
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('library', '0011_qivipquiz_difficulty'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='qivipquiz',
|
||||
name='difficulty',
|
||||
field=models.CharField(choices=[('public', 'Öffentlich'), ('hidden', 'Versteckt'), ('private', 'Privat')], default='not defined', max_length=10),
|
||||
),
|
||||
]
|
||||
18
django/library/migrations/0013_alter_qivipquiz_difficulty.py
Normal file
18
django/library/migrations/0013_alter_qivipquiz_difficulty.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.1.3 on 2025-03-08 13:40
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('library', '0012_alter_qivipquiz_difficulty'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='qivipquiz',
|
||||
name='difficulty',
|
||||
field=models.CharField(choices=[('1', '1'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), ('not defined', 'nicht gesetzt')], default='not defined', max_length=11),
|
||||
),
|
||||
]
|
||||
18
django/library/migrations/0014_alter_qivipquiz_difficulty.py
Normal file
18
django/library/migrations/0014_alter_qivipquiz_difficulty.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.1.3 on 2025-03-08 13:43
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('library', '0013_alter_qivipquiz_difficulty'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='qivipquiz',
|
||||
name='difficulty',
|
||||
field=models.CharField(choices=[('1', '1'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), ('not defined', 'nicht gesetzt')], default='not defined', help_text='1: niedrigste Schwierigkeit, 2: höchste Schwierigkeit', max_length=11),
|
||||
),
|
||||
]
|
||||
18
django/library/migrations/0015_alter_qivipquiz_difficulty.py
Normal file
18
django/library/migrations/0015_alter_qivipquiz_difficulty.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.1.3 on 2025-03-08 13:44
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('library', '0014_alter_qivipquiz_difficulty'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='qivipquiz',
|
||||
name='difficulty',
|
||||
field=models.CharField(choices=[('1', '1'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), ('not defined', 'nicht gesetzt')], default='not defined', help_text='1: niedrigste Schwierigkeit und 5: höchste Schwierigkeit', max_length=11),
|
||||
),
|
||||
]
|
||||
18
django/library/migrations/0016_alter_qivipquiz_status.py
Normal file
18
django/library/migrations/0016_alter_qivipquiz_status.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.1.7 on 2025-03-16 12:53
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('library', '0015_alter_qivipquiz_difficulty'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='qivipquiz',
|
||||
name='status',
|
||||
field=models.CharField(choices=[('öffentlich', 'Öffentlich'), ('versteckt', 'Versteckt'), ('privat', 'Privat')], default='öffentlich', max_length=10),
|
||||
),
|
||||
]
|
||||
18
django/library/migrations/0017_alter_qivipquiz_difficulty.py
Normal file
18
django/library/migrations/0017_alter_qivipquiz_difficulty.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.1.7 on 2025-03-16 12:54
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('library', '0016_alter_qivipquiz_status'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='qivipquiz',
|
||||
name='difficulty',
|
||||
field=models.CharField(choices=[('1', '1'), ('2', '2'), ('3', '3'), ('4', '4'), ('5', '5'), ('nicht gesetzt', 'nicht gesetzt')], default='nicht gesetzt', help_text='1: niedrigste Schwierigkeit und 5: höchste Schwierigkeit', max_length=13),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.1.7 on 2025-03-16 13:03
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('library', '0017_alter_qivipquiz_difficulty'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='qivipquiz',
|
||||
name='description',
|
||||
field=models.TextField(blank=True, default='In dem Quiz geht es um ...', max_length=150, null=True),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.1.7 on 2025-03-16 13:05
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('library', '0018_alter_qivipquiz_description'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='qivipquiz',
|
||||
name='description',
|
||||
field=models.TextField(default='In dem Quiz geht es um ...', max_length=255, null=True),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,19 @@
|
||||
# Generated by Django 5.1.7 on 2025-03-16 13:08
|
||||
|
||||
import library.models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('library', '0019_alter_qivipquiz_description'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='qivipquiz',
|
||||
name='description',
|
||||
field=models.TextField(default='In dem Quiz geht es um ...', max_length=255, validators=[library.models.QivipQuiz.validate_description]),
|
||||
),
|
||||
]
|
||||
18
django/library/migrations/0021_alter_qivipquiz_name.py
Normal file
18
django/library/migrations/0021_alter_qivipquiz_name.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.1.7 on 2025-03-16 14:34
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('library', '0020_alter_qivipquiz_description'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='qivipquiz',
|
||||
name='name',
|
||||
field=models.CharField(max_length=100),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,24 @@
|
||||
# Generated by Django 5.1.7 on 2025-03-16 14:35
|
||||
|
||||
import library.models
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('library', '0021_alter_qivipquiz_name'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='qivipquiz',
|
||||
name='description',
|
||||
field=models.TextField(default='In dem Quiz geht es um ...', max_length=200, validators=[library.models.QivipQuiz.validate_description]),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='qivipquiz',
|
||||
name='name',
|
||||
field=models.CharField(max_length=75),
|
||||
),
|
||||
]
|
||||
@@ -2,23 +2,39 @@ from django.db import models
|
||||
from django.contrib.auth.models import User
|
||||
from django.utils.text import slugify
|
||||
import uuid
|
||||
from django.core.exceptions import ValidationError
|
||||
|
||||
class QivipQuiz(models.Model):
|
||||
STATUS_VALUES = {
|
||||
"public": "Öffentlich",
|
||||
"hidden": "Versteckt",
|
||||
"private": "Privat",
|
||||
"öffentlich": "Öffentlich",
|
||||
"versteckt": "Versteckt",
|
||||
"privat": "Privat",
|
||||
}
|
||||
DIFFICULTY_VALUES = {
|
||||
"1": "1",
|
||||
"2": "2",
|
||||
"3": "3",
|
||||
"4": "4",
|
||||
"5": "5",
|
||||
"nicht gesetzt":"nicht gesetzt",
|
||||
|
||||
}
|
||||
|
||||
def validate_description(value):
|
||||
if value.strip() == "In dem Quiz geht es um ...":
|
||||
raise ValidationError("Bitte gib eine aussagekräftige Beschreibung ein.")
|
||||
|
||||
|
||||
uuid = models.UUIDField(default=uuid.uuid4, editable=False, unique=True)
|
||||
user_id = models.ForeignKey(User, on_delete=models.CASCADE, related_name='quiz')
|
||||
creation_date = models.DateTimeField(auto_now_add=True)
|
||||
update_date = models.DateTimeField(auto_now=True)
|
||||
status = models.CharField(max_length=10, choices=STATUS_VALUES.items())
|
||||
status = models.CharField(max_length=10, choices=list(STATUS_VALUES.items()), default="öffentlich")
|
||||
category = models.ForeignKey('QuizCategory', related_name='quiz', on_delete=models.CASCADE)
|
||||
tags = models.ManyToManyField('Tag', blank=True)
|
||||
name = models.CharField(max_length=255)
|
||||
description = models.TextField(blank=True, null=True)
|
||||
name = models.CharField(max_length=75)
|
||||
description = models.TextField(validators=[validate_description],max_length=200,blank=False, default="In dem Quiz geht es um ...")
|
||||
difficulty= models.CharField(max_length=13, choices=list(DIFFICULTY_VALUES.items()), default="nicht gesetzt", help_text="1: niedrigste Schwierigkeit und 5: höchste Schwierigkeit")
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
@@ -6,12 +6,18 @@ from django.contrib import messages
|
||||
from .models import QivipQuiz, QivipQuestion
|
||||
from .forms import QuizForm, QuestionForm
|
||||
import json
|
||||
|
||||
from django.core.paginator import Paginator
|
||||
# Übersicht aller Quizze
|
||||
@login_required
|
||||
|
||||
def overview_quiz(request):
|
||||
quizzes = QivipQuiz.objects.filter(user_id=request.user)
|
||||
return render(request, 'library/overview_quiz.html', {'quizzes': quizzes})
|
||||
try:
|
||||
quizzes = QivipQuiz.objects.filter(user_id=request.user)
|
||||
all_quizzes = QivipQuiz.objects.filter(status='öffentlich').exclude(user_id=request.user).filter(question__isnull=False).distinct()
|
||||
return render(request, 'library/overview_quiz.html', {'quizzes': quizzes, 'all_quizzes': all_quizzes})
|
||||
|
||||
except:
|
||||
all_quizzes = QivipQuiz.objects.filter(status='öffentlich').filter(question__isnull=False).distinct()
|
||||
return render(request, 'library/overview_quiz.html', {'quizzes': None, 'all_quizzes': all_quizzes})
|
||||
|
||||
# Neues Quiz erstellen
|
||||
@login_required
|
||||
@@ -100,7 +106,7 @@ def new_question(request):
|
||||
return redirect(f'{base_url}?type=multiple_choice&quiz_id={quiz_id}')
|
||||
|
||||
if request.method == 'POST':
|
||||
question_text = request.POST.get('question')
|
||||
question_text = request.POST.get('question', '')
|
||||
|
||||
# Handle different question types
|
||||
if question_type == 'true_false':
|
||||
@@ -140,27 +146,28 @@ def new_question(request):
|
||||
question = QivipQuestion()
|
||||
question.data = json.dumps(json_data)
|
||||
question.quiz_id = quiz
|
||||
question.type = question_type
|
||||
question.question = question_text
|
||||
question.save()
|
||||
return redirect('library:detail_quiz', pk=quiz.pk)
|
||||
else:
|
||||
# Initialize empty question data for new questions
|
||||
question_data = {
|
||||
'type': question_type,
|
||||
'question': '',
|
||||
'options': []
|
||||
}
|
||||
if question_type == 'true_false':
|
||||
question_data['options'] = [
|
||||
{'value': 'Wahr', 'is_correct': True},
|
||||
{'value': 'Falsch', 'is_correct': False}
|
||||
]
|
||||
question_data = {
|
||||
'type': question_type,
|
||||
'question': '',
|
||||
'options': [
|
||||
{'value': 'Wahr', 'is_correct': True},
|
||||
{'value': 'Falsch', 'is_correct': False}
|
||||
]
|
||||
}
|
||||
elif question_type == 'multiple_choice':
|
||||
question_data['options'] = [
|
||||
{'value': '', 'is_correct': False},
|
||||
{'value': '', 'is_correct': False}
|
||||
]
|
||||
question_data = {
|
||||
'type': question_type,
|
||||
'question': '',
|
||||
'options': [
|
||||
{'value': '', 'is_correct': False},
|
||||
{'value': '', 'is_correct': False}
|
||||
]
|
||||
}
|
||||
|
||||
template_name = f'library/question/question_{question_type}.html'
|
||||
context = {
|
||||
@@ -179,11 +186,53 @@ def edit_question(request, pk):
|
||||
return redirect('library:question_list')
|
||||
|
||||
# Parse the existing JSON data
|
||||
question_data = json.loads(question.data) if question.data else {}
|
||||
question_type = question_data.get('type', 'multiple_choice')
|
||||
try:
|
||||
question_data = json.loads(question.data) if question.data else {}
|
||||
question_type = question_data.get('type', 'multiple_choice')
|
||||
|
||||
# For true/false questions, get the correct answer from the options
|
||||
if question_type == 'true_false':
|
||||
# Default to true if no options exist
|
||||
correct_answer = True
|
||||
if question_data.get('options'):
|
||||
correct_answer = question_data['options'][0].get('is_correct', True)
|
||||
question_data = {
|
||||
'type': question_type,
|
||||
'question': question_data.get('question', ''),
|
||||
'correct_answer': correct_answer, # Add this for template compatibility
|
||||
'options': [
|
||||
{'value': 'Wahr', 'is_correct': correct_answer},
|
||||
{'value': 'Falsch', 'is_correct': not correct_answer}
|
||||
]
|
||||
}
|
||||
else:
|
||||
# For multiple choice questions
|
||||
question_data.setdefault('type', question_type)
|
||||
question_data.setdefault('question', '')
|
||||
question_data.setdefault('options', [])
|
||||
|
||||
except (json.JSONDecodeError, AttributeError):
|
||||
# Handle invalid JSON or None data
|
||||
question_type = question_data.get('type', 'multiple_choice')
|
||||
if question_type == 'true_false':
|
||||
question_data = {
|
||||
'type': question_type,
|
||||
'question': '',
|
||||
'correct_answer': True, # Default to true for new questions
|
||||
'options': [
|
||||
{'value': 'Wahr', 'is_correct': True},
|
||||
{'value': 'Falsch', 'is_correct': False}
|
||||
]
|
||||
}
|
||||
else:
|
||||
question_data = {
|
||||
'type': question_type,
|
||||
'question': '',
|
||||
'options': []
|
||||
}
|
||||
|
||||
if request.method == 'POST':
|
||||
question_text = request.POST.get('question')
|
||||
question_text = request.POST.get('question', '')
|
||||
|
||||
# Handle different question types
|
||||
if question_type == 'true_false':
|
||||
@@ -191,7 +240,6 @@ def edit_question(request, pk):
|
||||
json_data = {
|
||||
'type': question_type,
|
||||
'question': question_text,
|
||||
'correct_answer': correct_answer,
|
||||
'options': [
|
||||
{'value': 'Wahr', 'is_correct': correct_answer},
|
||||
{'value': 'Falsch', 'is_correct': not correct_answer}
|
||||
@@ -205,7 +253,7 @@ def edit_question(request, pk):
|
||||
options.append({
|
||||
'order': i,
|
||||
'value': request.POST.get(f'option_{i}'),
|
||||
'is_correct': int(request.POST.get(f'correct_{i}', 0))
|
||||
'is_correct': request.POST.get(f'correct_{i}') == '1'
|
||||
})
|
||||
i += 1
|
||||
|
||||
@@ -225,22 +273,18 @@ def edit_question(request, pk):
|
||||
'options': options
|
||||
}
|
||||
|
||||
question.question = question_text
|
||||
question.type = question_type
|
||||
question.data = json.dumps(json_data)
|
||||
question.save()
|
||||
return redirect('library:detail_quiz', pk=question.quiz_id.pk)
|
||||
else:
|
||||
question_data = json.loads(question.data) if question.data else {}
|
||||
template_name = f'library/question/question_{question_type}.html'
|
||||
context = {
|
||||
'question': {'data': question_data}, # Wrap in data structure expected by template
|
||||
'quiz_id': question.quiz_id.pk,
|
||||
'quiz': question.quiz_id
|
||||
}
|
||||
|
||||
template_name = f'library/question/question_{question_type}.html'
|
||||
context = {
|
||||
'question': question_data,
|
||||
'quiz_id': question.quiz_id.pk,
|
||||
'quiz': question.quiz_id
|
||||
}
|
||||
|
||||
return render(request, template_name, context)
|
||||
return render(request, template_name, context)
|
||||
|
||||
# Frage löschen
|
||||
@login_required
|
||||
0
django/play/__init__.py
Normal file
0
django/play/__init__.py
Normal file
6
django/play/admin.py
Normal file
6
django/play/admin.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from django.contrib import admin
|
||||
from .models import QuizGame, QuizGameParticipant
|
||||
|
||||
# Register your models here.
|
||||
admin.site.register(QuizGame)
|
||||
admin.site.register(QuizGameParticipant)
|
||||
6
django/play/apps.py
Normal file
6
django/play/apps.py
Normal file
@@ -0,0 +1,6 @@
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class PlayConfig(AppConfig):
|
||||
default_auto_field = 'django.db.models.BigAutoField'
|
||||
name = 'play'
|
||||
37
django/play/migrations/0001_initial.py
Normal file
37
django/play/migrations/0001_initial.py
Normal file
@@ -0,0 +1,37 @@
|
||||
# Generated by Django 5.1.7 on 2025-03-15 13:48
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('library', '0015_alter_qivipquiz_difficulty'),
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='QuizGame',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('join_code', models.CharField(max_length=6, unique=True)),
|
||||
('host_user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='host_user', to=settings.AUTH_USER_MODEL)),
|
||||
('quiz_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='library.qivipquiz')),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='QuizGameParticipant',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('display_name', models.CharField(max_length=15, verbose_name='Anzeigename')),
|
||||
('score', models.IntegerField(max_length=10, verbose_name='Punkte')),
|
||||
('avatar', models.CharField(max_length=200)),
|
||||
('quiz_game', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='participant', to='play.quizgame')),
|
||||
],
|
||||
),
|
||||
]
|
||||
18
django/play/migrations/0002_alter_quizgame_join_code.py
Normal file
18
django/play/migrations/0002_alter_quizgame_join_code.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# Generated by Django 5.1.7 on 2025-03-15 13:59
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('play', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='quizgame',
|
||||
name='join_code',
|
||||
field=models.CharField(blank=True, max_length=6, unique=True),
|
||||
),
|
||||
]
|
||||
@@ -0,0 +1,29 @@
|
||||
# Generated by Django 5.1.7 on 2025-03-15 19:05
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('play', '0002_alter_quizgame_join_code'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='quizgameparticipant',
|
||||
name='participant_id',
|
||||
field=models.CharField(default=1, max_length=200, unique=True),
|
||||
preserve_default=False,
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='quizgameparticipant',
|
||||
name='avatar',
|
||||
field=models.CharField(blank=True, default='', max_length=200),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='quizgameparticipant',
|
||||
name='score',
|
||||
field=models.IntegerField(default=0, verbose_name='Punkte'),
|
||||
),
|
||||
]
|
||||
0
django/play/migrations/__init__.py
Normal file
0
django/play/migrations/__init__.py
Normal file
40
django/play/models.py
Normal file
40
django/play/models.py
Normal file
@@ -0,0 +1,40 @@
|
||||
from django.db import models
|
||||
from django.contrib.auth.models import User
|
||||
from library.models import QivipQuiz
|
||||
from django.http import response
|
||||
import random, string
|
||||
|
||||
# Create your models here.
|
||||
class QuizGame(models.Model):
|
||||
host_user = models.ForeignKey(User, on_delete=models.CASCADE, related_name='host_user')
|
||||
join_code = models.CharField(max_length=6, unique=True, blank=True)
|
||||
quiz_id = models.ForeignKey(QivipQuiz, on_delete=models.CASCADE)
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
if not self.join_code:
|
||||
self.join_code = self.generate_unique_code()
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
def generate_unique_code(self):
|
||||
for i in range(10):
|
||||
new_code = ''.join(random.choices(string.digits, k=6))
|
||||
if not QuizGame.objects.filter(join_code=new_code).exists():
|
||||
return new_code
|
||||
|
||||
class QuizGameParticipant(models.Model):
|
||||
participant_id = models.CharField(max_length=200, unique=True)
|
||||
display_name = models.CharField(verbose_name="Anzeigename", max_length=15)
|
||||
quiz_game = models.ForeignKey(QuizGame, on_delete=models.CASCADE, related_name="participant")
|
||||
score = models.IntegerField(verbose_name="Punkte", default=0)
|
||||
avatar = models.CharField(max_length=200, blank=True, default="")
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
if not self.participant_id:
|
||||
self.participant_id = self.generate_unique_id()
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
def generate_unique_id(self):
|
||||
for i in range(10):
|
||||
new_id = ''.join(random.choices(string.digits + string.ascii_lowercase, k=60))
|
||||
if not QuizGameParticipant.objects.filter(participant_id=new_id).exists():
|
||||
return new_id
|
||||
3
django/play/tests.py
Normal file
3
django/play/tests.py
Normal file
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
10
django/play/urls.py
Normal file
10
django/play/urls.py
Normal file
@@ -0,0 +1,10 @@
|
||||
from django.urls import path
|
||||
from . import views
|
||||
|
||||
app_name = 'play'
|
||||
|
||||
urlpatterns = [
|
||||
path('lobby/<str:join_code>', views.lobby, name='lobby'),
|
||||
path('lobby/<str:join_code>/participate', views.create_participant, name='create_participant'),
|
||||
path('join', views.join_game, name='join_game'),
|
||||
]
|
||||
60
django/play/views.py
Normal file
60
django/play/views.py
Normal file
@@ -0,0 +1,60 @@
|
||||
from django.shortcuts import render
|
||||
from django.shortcuts import render, redirect, get_object_or_404, reverse
|
||||
from play.models import QuizGame, QuizGameParticipant
|
||||
from library.models import QivipQuiz
|
||||
from django.http import HttpResponseRedirect
|
||||
|
||||
# Create your views here.
|
||||
def lobby(request, join_code):
|
||||
if not "participant_id" in request.COOKIES:
|
||||
return redirect('play:create_participant', join_code=join_code)
|
||||
participant_id = request.COOKIES['participant_id']
|
||||
quiz_game = get_object_or_404(QuizGame, join_code=join_code)
|
||||
quiz = get_object_or_404(QivipQuiz, pk=quiz_game.quiz_id.id)
|
||||
participant = get_object_or_404(QuizGameParticipant, participant_id=participant_id)
|
||||
|
||||
if not participant.quiz_game.join_code == join_code:
|
||||
participant.quiz_game = quiz_game
|
||||
participant.save()
|
||||
|
||||
context = {
|
||||
'debug': "test",
|
||||
'participant': participant,
|
||||
'quiz': quiz,
|
||||
}
|
||||
|
||||
return render(request, 'play/lobby.html', context=context)
|
||||
|
||||
def create_participant(request, join_code):
|
||||
if "participant_id" in request.COOKIES: # Umleiten, falls Teilnehmer bereits erstellt
|
||||
return redirect('play:lobby', join_code=join_code)
|
||||
if request.method == 'POST':
|
||||
display_name = request.POST.get('display_name')
|
||||
join_code = request.POST.get('join_code')
|
||||
try:
|
||||
quiz = QuizGame.objects.get(join_code=join_code)
|
||||
participant = QuizGameParticipant()
|
||||
participant.display_name = display_name
|
||||
participant.quiz_game = quiz
|
||||
participant.save()
|
||||
|
||||
response = HttpResponseRedirect(reverse('play:lobby', kwargs={'join_code': join_code}))
|
||||
response.set_cookie('participant_id', participant.participant_id, max_age=3600)
|
||||
|
||||
return response
|
||||
except QuizGame.DoesNotExist:
|
||||
# TODO: Fehlermeldung fuer nicht-existierendes Quiz
|
||||
pass
|
||||
|
||||
return render(request, 'play/initialize_participant.html', {'join_code': join_code})
|
||||
|
||||
def join_game(request):
|
||||
if request.method == 'POST':
|
||||
join_code = request.POST.get('game_code')
|
||||
try:
|
||||
quiz = QuizGame.objects.get(join_code=join_code)
|
||||
return redirect('play:lobby', join_code=join_code)
|
||||
except QuizGame.DoesNotExist:
|
||||
# TODO: Mit message eine Fehlermeldung weitergeben (und im entsprechenden Template Designen)
|
||||
pass
|
||||
return render(request, 'play/join_game.html')
|
||||
@@ -1,5 +1,9 @@
|
||||
@import 'tailwindcss';
|
||||
|
||||
qp-container {
|
||||
@apply max-w-xl w-full mx-auto;
|
||||
}
|
||||
|
||||
nav div ul.qp-nav-list li {
|
||||
@apply text-white hover:scale-110 hover:border-b-2 hover:border-white transition duration-200;
|
||||
}
|
||||
@@ -7,7 +11,10 @@ nav div ul.qp-nav-list li {
|
||||
a.qp-a-button {
|
||||
@apply p-6 rounded-md font-extrabold hover:scale-105 transition duration-300 shadow-md;
|
||||
}
|
||||
.register input{@apply p-3 rounded-full bg-gray-200 focus:scale-105 transition duration-200 font-black;}
|
||||
a.qp-a-button-small {
|
||||
@apply p-1 rounded-md hover:scale-105 transition duration-300 shadow-md;
|
||||
}
|
||||
.register input{@apply p-3 rounded-full bg-gray-200 focus:scale-105 transition duration-200 font-black w-full;}
|
||||
|
||||
.input-group {
|
||||
@apply flex flex-col gap-4 max-w-md mx-auto p-6 bg-white rounded-xl shadow-lg;
|
||||
BIN
django/static/icons/favicon.png
Normal file
BIN
django/static/icons/favicon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
25
django/templates/accounts/home.html
Normal file
25
django/templates/accounts/home.html
Normal file
@@ -0,0 +1,25 @@
|
||||
{% extends 'base.html'%}
|
||||
{% block title %}Home{% endblock %}
|
||||
{% block content %}
|
||||
|
||||
|
||||
<div class="flex justify-center items-center mt-12 ">
|
||||
<div class="input-group p-4 m-2 border-blue-600 border-2 rounded-xl shadow-md">
|
||||
<div class="grid place-content-center h-120">
|
||||
|
||||
<h1 class="text-center m-4 text-3xl lg:text-6xl">Willkommen, <b>{{ request.user.username }}</b>!</h1>
|
||||
|
||||
<form action="{% url 'accounts:logout' %}" method="post">
|
||||
{% csrf_token %}
|
||||
<button class="bg-blue-600 text-white p-3 rounded-full font-black" type="submit">Abmelden</button>
|
||||
</form>
|
||||
</div>
|
||||
<div class="flex justify-end">
|
||||
<span class="text-[clamp(0.6rem,5vw,1rem)] font-black overflow-x-auto mt-1 ml-0.75 text-blue-600 p-0.75 bg-white">qivip
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
@@ -1,13 +1,13 @@
|
||||
{% extends 'accounts/base.html' %}
|
||||
{% extends 'base.html' %}
|
||||
{% load static %}
|
||||
{% block title %}Anmeldung{% endblock %}
|
||||
{% block content %}
|
||||
<div class="grid place-content-center h-120">
|
||||
<div class="p-4 m-2 border-blue-600 border-2 rounded-xl shadow-md">
|
||||
<div class="grid place-content-center h-120 mt-12 mb-12 ">
|
||||
<div class="w-80 p-4 m-2 border-blue-600 border-2 rounded-xl shadow-md lg:w-90">
|
||||
<h2 class="text-2xl text-center p-4 font-black">Anmeldung</h2>
|
||||
<form class="space-y-4" method="post">
|
||||
{% if form.errors %}
|
||||
<div class="text-red-600 font-black overflow-x-auto break-words text-center">
|
||||
<div class=" items-center text-red-600 font-black overflow-x-auto break-words text-center">
|
||||
<ul>
|
||||
{% for field, errors in form.errors.items %}
|
||||
{% for error in errors %}
|
||||
@@ -18,11 +18,11 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
{% csrf_token %}
|
||||
<div class="">
|
||||
<input class="p-3 rounded-full bg-gray-200 focus:scale-105 transition duration-200 font-black" type="text" name="username" id="username" required placeholder="BENUTZERNAME">
|
||||
<div class="items-center w-full">
|
||||
<input class=" w-full p-3 rounded-full bg-gray-200 focus:scale-105 transition duration-200 font-black" type="text" name="username" id="username" required placeholder="BENUTZERNAME">
|
||||
</div>
|
||||
<div class="">
|
||||
<input class="p-3 rounded-full bg-gray-200 focus:scale-105 transition duration-200 font-black" type="password" name="password" id="password" required placeholder="PASSWORT">
|
||||
<div class="items-center w-full">
|
||||
<input class=" w-full p-3 rounded-full bg-gray-200 focus:scale-105 transition duration-200 font-black" type="password" name="password" id="password" required placeholder="PASSWORT">
|
||||
</div>
|
||||
<button class="w-full p-3 rounded-full bg-blue-600 text-white font-black hover:scale-105 transition duration-200" type="submit" class="login-button">Anmelden</button>
|
||||
</form>
|
||||
@@ -1,8 +1,9 @@
|
||||
{% extends 'accounts/base.html' %}
|
||||
{% extends 'base.html' %}
|
||||
{% block title %}Registrierung{% endblock %}
|
||||
{% block content %}
|
||||
<div class="grid place-content-center h-120">
|
||||
<div class=" p-4 m-2 border-blue-600 border-2 rounded-xl shadow-md">
|
||||
<div class="grid place-content-center h-120 mt-12 mb-12">
|
||||
|
||||
<div class="w-80 p-4 m-2 border-blue-600 border-2 rounded-xl shadow-md lg:w-90">
|
||||
<h2 class="text-2xl text-center p-4 font-black">Registrieren</h2>
|
||||
|
||||
<form class=" space-y-4" method="post">
|
||||
17
django/templates/base.html
Normal file
17
django/templates/base.html
Normal file
@@ -0,0 +1,17 @@
|
||||
{% load static %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="de">
|
||||
<head>
|
||||
<link rel="icon" type="image/png" href="{% static 'icons/favicon.png' %}">
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" href="{% static 'css/t-style.css' %}">
|
||||
<title>qivip</title>
|
||||
</head>
|
||||
<body>
|
||||
{% include 'partials/_nav.html' %}
|
||||
{% block content%}{% endblock %}
|
||||
{% include 'partials/_footer.html' %}
|
||||
{% block extra_js %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,4 +1,4 @@
|
||||
{% extends 'homepage/base.html' %}
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<div class="grid place-content-center md:h-screen h-150 w-full -z-50 top-0 p-4">
|
||||
@@ -7,9 +7,9 @@
|
||||
<h3 class="italic font-extralight sm:text-2xl text-md">Interaktives Lernen neu definiert.</h3>
|
||||
</div>
|
||||
<div class="grid sm:grid-cols-3 place-items-stretch text-center mt-8 gap-4 p-4 border-3 bg-blue-100 border-blue-100 rounded-md">
|
||||
<a class="qp-a-button bg-green-500 text-white" href="#">Teilnehmen</a>
|
||||
<a class="qp-a-button bg-green-500 text-white" href="{% url 'play:join_game' %}">Teilnehmen</a>
|
||||
<a class="qp-a-button bg-indigo-500 text-white" href="#">Moderieren</a>
|
||||
<a class="qp-a-button bg-purple-500 text-white" href="#">Verwalten</a>
|
||||
<a class="qp-a-button bg-purple-500 text-white" href="{% url 'library:new_quiz' %}">Erstellen</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
36
django/templates/homepage/impress.html
Normal file
36
django/templates/homepage/impress.html
Normal file
@@ -0,0 +1,36 @@
|
||||
{% extends 'base.html' %}
|
||||
{% block content%}
|
||||
|
||||
<div class="flex justify-center items-center mt-12 ">
|
||||
<div class="input-group p-4 m-2 border-blue-600 border-2 rounded-xl shadow-md">
|
||||
<div class="grid place-content-center h-120">
|
||||
|
||||
<h1 class="text-center m-4 text-3xl lg:text-6xl">Impressum</b></h1>
|
||||
Katharineum zu Lübeck <br>
|
||||
Königsstraße 27-31 <br>
|
||||
23552 Lübeck
|
||||
</div>
|
||||
|
||||
<div class="flex justify-end">
|
||||
<span class="text-[clamp(0.6rem,5vw,1rem)] font-black overflow-x-auto mt-1 ml-0.75 text-blue-600 p-0.75 bg-white">qivip
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</body>
|
||||
</html>
|
||||
23
django/templates/homepage/privacy.html
Normal file
23
django/templates/homepage/privacy.html
Normal file
@@ -0,0 +1,23 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block content%}
|
||||
<div class="flex justify-center items-center mt-12 ">
|
||||
<div class="input-group p-4 m-2 border-blue-600 border-2 rounded-xl shadow-md">
|
||||
<div class="grid place-content-center h-120">
|
||||
|
||||
<h1 class="text-center m-4 text-3xl break-words lg:text-6xl">Datenschutz-<br>erklärung</b></h1>
|
||||
Hier muss die Datenschutzerklärung stehen! <br>
|
||||
<br>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="flex justify-end">
|
||||
<span class="text-[clamp(0.6rem,5vw,1rem)] font-black overflow-x-auto mt-1 ml-0.75 text-blue-600 p-0.75 bg-white">qivip
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,9 +1,9 @@
|
||||
{% extends 'library/base.html' %}
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container mx-auto px-4">
|
||||
<div class="max-w-lg mx-auto mt-10">
|
||||
<div class="bg-white rounded-lg shadow-md p-6">
|
||||
<div class="bg-white rounded-lg shadow-md p-6 border-blue-600 border-2 rounded-xl shadow-md">
|
||||
<div class="text-center">
|
||||
<svg class="mx-auto h-12 w-12 text-red-500" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/>
|
||||
@@ -1,12 +1,12 @@
|
||||
{% extends 'library/base.html' %}
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container mx-auto px-4">
|
||||
<div class="flex justify-between items-center mb-6">
|
||||
<h1 class="text-2xl font-bold">{{ quiz.name }}</h1>
|
||||
<div class="flex space-x-2">
|
||||
<a href="{% url 'library:edit_quiz' quiz.id %}" class="bg-blue-500 text-white px-4 py-2 rounded-md hover:bg-blue-600 transition-colors">Bearbeiten</a>
|
||||
<a href="{% url 'library:delete_quiz' quiz.id %}" class="bg-red-500 text-white px-4 py-2 rounded-md hover:bg-red-600 transition-colors">Löschen</a>
|
||||
<a href="{% url 'library:edit_quiz' quiz.id %}" class=" text-white px-4 py-2 rounded-md text-sm lg:text-lg hover:scale-110 transition-colors">✏</a>
|
||||
<a href="{% url 'library:delete_quiz' quiz.id %}" class=" text-white px-4 py-2 rounded-md text-sm lg:text-lg hover:scale-110 transition-colors">🗑</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -14,17 +14,17 @@
|
||||
<p class="text-gray-600 mb-8">{{ quiz.description }}</p>
|
||||
{% endif %}
|
||||
|
||||
<div class="bg-white rounded-lg shadow-md">
|
||||
<div class="bg-white rounded-lg shadow-md border-blue-600 border-2 rounded-xl shadow-md">
|
||||
<div class="border-b border-gray-200 p-4">
|
||||
<div class="flex justify-between items-center">
|
||||
<h2 class="text-xl font-semibold">Fragen</h2>
|
||||
<div class="flex space-x-2">
|
||||
<a href="{% url 'library:new_question' %}?type=multiple_choice&quiz_id={{ quiz.id }}"
|
||||
class="bg-green-500 text-white px-4 py-2 rounded-md hover:bg-green-600 transition-colors">
|
||||
class="bg-blue-100 text-blue-800 px-4 py-2 rounded-md text-xs lg:text-lg hover:border-blue-600 border-2">
|
||||
Multiple Choice
|
||||
</a>
|
||||
<a href="{% url 'library:new_question' %}?type=true_false&quiz_id={{ quiz.id }}"
|
||||
class="bg-green-500 text-white px-4 py-2 rounded-md hover:bg-green-600 transition-colors">
|
||||
class="bg-purple-100 text-purple-800 px-4 py-2 rounded-md text-xs lg:text-lg hover:border-blue-600 border-2">
|
||||
Wahr/Falsch
|
||||
</a>
|
||||
</div>
|
||||
@@ -32,10 +32,14 @@
|
||||
</div>
|
||||
|
||||
{% if questions %}
|
||||
|
||||
<div class="divide-y divide-gray-200">
|
||||
{% for question in questions %}
|
||||
<div class="p-4 hover:bg-gray-50">
|
||||
|
||||
<div class="w-full rounded-xl p-4 hover:bg-gray-50">
|
||||
<a class="block flex h-full w-full" href="{% url 'library:edit_question' question.id %}" >
|
||||
<div class="flex justify-between items-start">
|
||||
|
||||
<div class="flex-grow">
|
||||
<p class="font-medium">{{ question.data.question }}</p>
|
||||
<div class="mt-1">
|
||||
@@ -45,7 +49,7 @@
|
||||
</div>
|
||||
<div class="mt-2">
|
||||
{% if question.data.type == 'multiple_choice' %}
|
||||
<ul class="space-y-1">
|
||||
<ul class="space-y-1 ">
|
||||
{% for option in question.data.options %}
|
||||
<li class="flex items-center text-sm">
|
||||
{% if option.is_correct %}
|
||||
@@ -63,30 +67,41 @@
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
{% for option in question.data.options %}
|
||||
{% if option.is_correct %}
|
||||
<p class="text-sm">
|
||||
<span class="text-gray-500">Richtige Antwort:</span>
|
||||
<span class="ml-1 font-medium {% if question.data.correct_answer %}text-green-700{% else %}text-red-700{% endif %}">
|
||||
{% if question.data.correct_answer %}Wahr{% else %}Falsch{% endif %}
|
||||
</span>
|
||||
</p>
|
||||
<span class="text-gray-500">Richtige Antwort:</span>
|
||||
<span class="ml-1 font-medium {% if option.value == "Wahr" %} text-green-700 {% else %}text-red-700{% endif %}">{{ option.value }}</span>
|
||||
</p>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex space-x-2 ml-4">
|
||||
|
||||
<div class="flex h-full space-x-2 ml-4 items-center">
|
||||
<!--
|
||||
<a href="{% url 'library:edit_question' question.id %}"
|
||||
class="bg-gray-100 text-gray-700 px-3 py-1 rounded hover:bg-gray-200 transition-colors">
|
||||
Bearbeiten
|
||||
</a>
|
||||
<a href="{% url 'library:delete_question' question.id %}"
|
||||
class="bg-red-100 text-red-700 px-3 py-1 rounded hover:bg-red-200 transition-colors">
|
||||
Löschen
|
||||
</a>
|
||||
-->
|
||||
|
||||
<a href=" {% url 'library:delete_question' question.id %}"
|
||||
class=" text-red-700 px-4 py-1 rounded hover:scale-110 ">
|
||||
🗑
|
||||
</a>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</a>
|
||||
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
{% else %}
|
||||
|
||||
<div class="p-8 text-center">
|
||||
<svg class="mx-auto h-12 w-12 text-gray-400" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2"/>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user