CRUD Operations for Library models
This commit is contained in:
@@ -9,7 +9,9 @@
|
||||
</head>
|
||||
<body>
|
||||
{% include 'homepage/partials/_nav.html' %}
|
||||
{% block content%}{% endblock %}
|
||||
<div class="max-w-screen-lg mx-auto">
|
||||
{% block content%}{% endblock %}
|
||||
</div>
|
||||
{% include 'homepage/partials/_footer.html' %}
|
||||
</body>
|
||||
</html>
|
||||
11
core/library/templates/library/delete_confirmation.html
Normal file
11
core/library/templates/library/delete_confirmation.html
Normal file
@@ -0,0 +1,11 @@
|
||||
{% extends 'library/base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Löschen</h1>
|
||||
<p>Soll das Quiz "{{ object.name }}" wirklich gelöscht werden?</p>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
<button type="submit">Löschen</button>
|
||||
<a href="{% url 'library:overview_quiz' %}">Abbrechen</a>
|
||||
</form>
|
||||
{% endblock %}
|
||||
19
core/library/templates/library/detail_quiz.html
Normal file
19
core/library/templates/library/detail_quiz.html
Normal file
@@ -0,0 +1,19 @@
|
||||
{% extends 'library/base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<h1>{{ quiz.name }}</h1>
|
||||
<p>{{ quiz.description }}</p>
|
||||
<a href="{% url 'library:edit_quiz' quiz.id %}">Bearbeiten</a>
|
||||
<a href="{% url 'library:delete_quiz' quiz.id %}">Löschen</a>
|
||||
|
||||
<h2>Fragen</h2>
|
||||
<ul>
|
||||
<a href="{% url 'library:new_question' %}">Neue Frage erstellen</a>
|
||||
{% for question in questions %}
|
||||
<li>{{ question.data }}</li>
|
||||
<a href="{% url 'library:edit_question' question.id %}">Bearbeiten</a>
|
||||
<a href="{% url 'library:delete_question' question.id %}">Löschen</a>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
|
||||
{% endblock %}
|
||||
13
core/library/templates/library/form.html
Normal file
13
core/library/templates/library/form.html
Normal file
@@ -0,0 +1,13 @@
|
||||
{% extends 'library/base.html' %}
|
||||
|
||||
{% block content %}
|
||||
<h1>Formular</h1>
|
||||
<h2>{{ form.name.value }}</h2>
|
||||
<div class="input-group">
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<button type="submit">Speichern</button>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock %}
|
||||
19
core/library/templates/library/overview_quiz.html
Normal file
19
core/library/templates/library/overview_quiz.html
Normal file
@@ -0,0 +1,19 @@
|
||||
{% 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 %}
|
||||
Reference in New Issue
Block a user