This commit is contained in:
Holger Sielaff
2024-09-21 12:33:00 +02:00
parent be447f4862
commit 5b1c2ce0c9
5 changed files with 15 additions and 4 deletions

View File

@@ -49,6 +49,8 @@ class LabelAdmin(PermissionsAdminMixin, admin.ModelAdmin):
@admin.register(SubmittedQuestion) @admin.register(SubmittedQuestion)
class SubmittedQuestionAdmin(admin.ModelAdmin): class SubmittedQuestionAdmin(admin.ModelAdmin):
list_filter = [ActiveFilter,] list_filter = [ActiveFilter,]
list_display = ['__str__', 'release']
list_editable = ['release',]
@admin.register(Question) @admin.register(Question)

View File

@@ -94,6 +94,7 @@ def release_submitted(sender, instance: SubmittedQuestion, **kwargs):
buzzword=instance.buzzword, buzzword=instance.buzzword,
question=instance.question, question=instance.question,
awnser=instance.awnser, awnser=instance.awnser,
is_published=True,
) )
try: try:
n.labels.set(instance.labels.all()) n.labels.set(instance.labels.all())

View File

@@ -34,11 +34,18 @@
} }
</style> </style>
{% if messages %} {% if messages %}
<ul class="messages"> <div class="messages">
{% for message in messages %} {% for message in messages %}
<li{% if message.tags %} class="{{ message.tags }}"{% endif %}>{{ message }}</li> <div{% if message.tags %} class="alert alert-{{ message.tags }} alert-dismissible fade show"{% endif %} onclick="$(this).fadeOut('slow');">
{{ message }}
<!--
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
-->
</div>
{% endfor %} {% endfor %}
</ul> </div>
{% endif %} {% endif %}
<div class="form_wrapper"> <div class="form_wrapper">
<form method="post" action="?"> <form method="post" action="?">

View File

@@ -51,7 +51,7 @@ def submit_question(request):
question=form.cleaned_data['question'], question=form.cleaned_data['question'],
awnser=form.cleaned_data['awnser'], awnser=form.cleaned_data['awnser'],
) )
messages.info(request, f"Angelegt mit ID {subq.id}") messages.info(request, f"Die Frage wurde eingereicht")
return render(request, 'submit-question.html', {'form': SubmitQuestion()}) return render(request, 'submit-question.html', {'form': SubmitQuestion()})
else: else:
[messages.error(request,f'Error in {err}') for err in form.errors] [messages.error(request,f'Error in {err}') for err in form.errors]

View File

@@ -5,6 +5,7 @@
<title>TablequizDB</title> <title>TablequizDB</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/jquery-3.7.1.min.js" integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
<style type="text/css"> <style type="text/css">
.input-group.input-group-unstyled input.form-control { .input-group.input-group-unstyled input.form-control {
-webkit-border-radius: 4px; -webkit-border-radius: 4px;