update form to baseform, autofocus to all form
This commit is contained in:
@@ -153,6 +153,11 @@ class TopicCreateForm(forms.ModelForm):
|
||||
"topic_group": HiddenInput,
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs) # to get the self.fields set
|
||||
|
||||
self.fields["title"].autofocus = True
|
||||
|
||||
|
||||
class TopicUpdateForm(forms.ModelForm):
|
||||
class Meta:
|
||||
@@ -173,11 +178,15 @@ class TopicUpdateForm(forms.ModelForm):
|
||||
"topic_group": HiddenInput,
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs) # to get the self.fields set
|
||||
|
||||
self.fields["title"].autofocus = True
|
||||
|
||||
|
||||
class AttachmentCreateForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Attachment
|
||||
|
||||
fields = [
|
||||
"title",
|
||||
"description",
|
||||
@@ -194,11 +203,15 @@ class AttachmentCreateForm(forms.ModelForm):
|
||||
"topic": HiddenInput,
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs) # to get the self.fields set
|
||||
|
||||
self.fields["title"].autofocus = True
|
||||
|
||||
|
||||
class AttachmentUpdateForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Attachment
|
||||
|
||||
fields = [
|
||||
"title",
|
||||
"description",
|
||||
@@ -215,11 +228,15 @@ class AttachmentUpdateForm(forms.ModelForm):
|
||||
"topic": HiddenInput,
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs) # to get the self.fields set
|
||||
|
||||
class EtherpadForm(forms.ModelForm):
|
||||
self.fields["title"].autofocus = True
|
||||
|
||||
|
||||
class EtherpadCreateForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Etherpad
|
||||
|
||||
fields = [
|
||||
"title",
|
||||
"date",
|
||||
@@ -236,8 +253,13 @@ class EtherpadForm(forms.ModelForm):
|
||||
"attachment": HiddenInput,
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs) # to get the self.fields set
|
||||
|
||||
class FileUploadForm(forms.ModelForm):
|
||||
self.fields["title"].autofocus = True
|
||||
|
||||
|
||||
class FileUploadCreateForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = FileUpload
|
||||
fields = [
|
||||
@@ -246,6 +268,16 @@ class FileUploadForm(forms.ModelForm):
|
||||
"attachment",
|
||||
]
|
||||
|
||||
labels = {
|
||||
"title": "Titel",
|
||||
"date": "Datum",
|
||||
}
|
||||
|
||||
widgets = {
|
||||
"attachment": HiddenInput,
|
||||
}
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs) # to get the self.fields set
|
||||
|
||||
self.fields["file_field"].autofocus = True
|
||||
|
||||
@@ -14,8 +14,8 @@ from fet2020.utils import add_log_action
|
||||
from .forms import (
|
||||
AttachmentCreateForm,
|
||||
AttachmentUpdateForm,
|
||||
EtherpadForm,
|
||||
FileUploadForm,
|
||||
EtherpadCreateForm,
|
||||
FileUploadCreateForm,
|
||||
TopicCreateForm,
|
||||
TopicUpdateForm,
|
||||
)
|
||||
@@ -45,7 +45,7 @@ class TopicCreateView(LoginRequiredMixin, CreateView):
|
||||
form_class = TopicCreateForm
|
||||
model = Topic
|
||||
success_url = reverse_lazy("intern:index")
|
||||
template_name = "intern/topic/topic_create.html"
|
||||
template_name = "intern/topic/create.html"
|
||||
|
||||
def form_valid(self, form):
|
||||
form.instance.created_by = self.request.user
|
||||
@@ -61,7 +61,7 @@ class TopicCreateView(LoginRequiredMixin, CreateView):
|
||||
|
||||
class TopicDetailView(LoginRequiredMixin, DetailView):
|
||||
model = Topic
|
||||
template_name = "intern/topic/topic_detail.html"
|
||||
template_name = "intern/topic/detail.html"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
@@ -80,7 +80,7 @@ class TopicDetailView(LoginRequiredMixin, DetailView):
|
||||
class TopicUpdateView(LoginRequiredMixin, UpdateView):
|
||||
form_class = TopicUpdateForm
|
||||
model = Topic
|
||||
template_name = "intern/topic/topic_update.html"
|
||||
template_name = "intern/topic/update.html"
|
||||
|
||||
def form_valid(self, form):
|
||||
form.instance.created_by = self.request.user
|
||||
@@ -95,7 +95,7 @@ class TopicUpdateView(LoginRequiredMixin, UpdateView):
|
||||
class AttachmentCreateView(LoginRequiredMixin, CreateView):
|
||||
form_class = AttachmentCreateForm
|
||||
model = Attachment
|
||||
template_name = "intern/attachment/attachment_create.html"
|
||||
template_name = "intern/attachment/create.html"
|
||||
|
||||
def form_valid(self, form):
|
||||
form.instance.created_by = self.request.user
|
||||
@@ -117,7 +117,7 @@ class AttachmentCreateView(LoginRequiredMixin, CreateView):
|
||||
|
||||
class AttachmentDetailView(LoginRequiredMixin, DetailView):
|
||||
model = Attachment
|
||||
template_name = "intern/attachment/attachment_detail.html"
|
||||
template_name = "intern/attachment/detail.html"
|
||||
|
||||
def get(self, request, *args, **kwargs):
|
||||
response = super().get(request, *args, **kwargs)
|
||||
@@ -150,7 +150,7 @@ class AttachmentDetailView(LoginRequiredMixin, DetailView):
|
||||
class AttachmentUpdateView(LoginRequiredMixin, UpdateView):
|
||||
form_class = AttachmentUpdateForm
|
||||
model = Attachment
|
||||
template_name = "intern/attachment/attachment_update.html"
|
||||
template_name = "intern/attachment/update.html"
|
||||
|
||||
def form_valid(self, form):
|
||||
form.instance.created_by = self.request.user
|
||||
@@ -171,9 +171,9 @@ class AttachmentUpdateView(LoginRequiredMixin, UpdateView):
|
||||
|
||||
|
||||
class EtherpadCreateView(LoginRequiredMixin, CreateView):
|
||||
form_class = EtherpadForm
|
||||
form_class = EtherpadCreateForm
|
||||
model = Etherpad
|
||||
template_name = "intern/etherpad_create.html"
|
||||
template_name = "intern/etherpad/create.html"
|
||||
|
||||
def form_valid(self, form):
|
||||
form.instance.created_by = self.request.user
|
||||
@@ -198,9 +198,9 @@ class EtherpadCreateView(LoginRequiredMixin, CreateView):
|
||||
|
||||
|
||||
class FileUploadCreateView(LoginRequiredMixin, CreateView):
|
||||
form_class = FileUploadForm
|
||||
form_class = FileUploadCreateForm
|
||||
model = FileUpload
|
||||
template_name = "intern/file_create.html"
|
||||
template_name = "intern/fileupload/create.html"
|
||||
|
||||
def form_valid(self, form):
|
||||
form.instance.created_by = self.request.user
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
<input
|
||||
type="file"
|
||||
name={{ field.name }}
|
||||
{% if field.field.required %}required{% endif %}
|
||||
{% if field.field.disabled %}disabled{% endif %}
|
||||
{% if field.field.autofocus %}autofocus{% endif %}
|
||||
class="text-gray-700 dark:text-gray-200 block w-full mt-1 rounded-md border-gray-300 dark:border-none shadow-sm focus:border-none focus:ring focus:ring-blue-200 dark:focus:ring-sky-700 focus:ring-opacity-50"
|
||||
>
|
||||
</label>
|
||||
|
||||
@@ -1,48 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Anhang Ordner hinzufügen{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<!-- Main Content -->
|
||||
<main class="container mx-auto w-full px-4 my-8 flex-1">
|
||||
<h1 class="page-title">Anhang Ordner hinzufügen</h1>
|
||||
<div class="w-full h-full flex-1 flex justify-center items-center">
|
||||
<form action="" method="POST" enctype="multipart/form-data" class="w-full max-w-prose sm:px-28 sm:py-4 grid grid-cols-1 gap-y-3 sm:gap-y-6 text-gray-900">
|
||||
{% csrf_token %}
|
||||
|
||||
{% if form.non_field_errors %}
|
||||
<div class="alert alert-danger">
|
||||
<i class="alert-icon fa-solid fa-check-circle"></i>
|
||||
<h2 class="alert-title">Fehler:</h2>
|
||||
<div class="alert-body">{{ form.non_field_errors }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<label class="block">
|
||||
<span class="text-gray-700 dark:text-gray-200">{{ form.title.label }}</span>
|
||||
{% if form.title.errors %}
|
||||
<div class="alert alert-danger">
|
||||
<div class="alert-body">{{ form.title.errors }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<input type="text" id="id_title" name="title" class="mt-1 block w-full rounded-md border-gray-300 dark:border-none shadow-sm focus:border-none focus:ring focus:ring-blue-200 dark:focus:ring-sky-700 focus:ring-opacity-50" required>
|
||||
</label>
|
||||
|
||||
<label class="block">
|
||||
<span class="text-gray-700 dark:text-gray-200">{{ form.description.label }}</span>
|
||||
{% if form.description.errors %}
|
||||
<div class="alert alert-danger">
|
||||
<div class="alert-body">{{ form.description.errors }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{{ form.media }}
|
||||
{{ form.description }}
|
||||
</label>
|
||||
|
||||
<input type="hidden" name="topic" value="{{ topic.id }}" id="id_topic">
|
||||
|
||||
<input type="submit" class="block btn btn-primary" value="Hinzufügen">
|
||||
</form>
|
||||
</div>
|
||||
</main>
|
||||
{% endblock %}
|
||||
@@ -1,48 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}{{ attachment.title }} bearbeiten{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<!-- Main Content -->
|
||||
<main class="container mx-auto w-full px-4 my-8 flex-1">
|
||||
<h1 class="page-title">Anhang Ordner '{{ attachment.title }}' bearbeiten</h1>
|
||||
<div class="w-full h-full flex-1 flex justify-center items-center">
|
||||
<form action="" method="POST" enctype="multipart/form-data" class="w-full max-w-prose sm:px-28 sm:py-4 grid grid-cols-1 gap-y-3 sm:gap-y-6 text-gray-900">
|
||||
{% csrf_token %}
|
||||
|
||||
{% if form.non_field_errors %}
|
||||
<div class="alert alert-danger">
|
||||
<i class="alert-icon fa-solid fa-check-circle"></i>
|
||||
<h2 class="alert-title">Fehler:</h2>
|
||||
<div class="alert-body">{{ form.non_field_errors }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<label class="block">
|
||||
<span class="text-gray-700 dark:text-gray-200">{{ form.title.label }}</span>
|
||||
{% if form.title.errors %}
|
||||
<div class="alert alert-danger">
|
||||
<div class="alert-body">{{ form.title.errors }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<input type="text" id="id_title" name="title" value="{{ attachment.title }}" class="mt-1 block w-full rounded-md border-gray-300 dark:border-none shadow-sm focus:border-none focus:ring focus:ring-blue-200 dark:focus:ring-sky-700 focus:ring-opacity-50" required>
|
||||
</label>
|
||||
|
||||
<label class="block">
|
||||
<span class="text-gray-700 dark:text-gray-200">{{ form.description.label }}</span>
|
||||
{% if form.description.errors %}
|
||||
<div class="alert alert-danger">
|
||||
<div class="alert-body">{{ form.description.errors }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{{ form.media }}
|
||||
{{ form.description }}
|
||||
</label>
|
||||
|
||||
<input type="hidden" name="topic" value="{{ attachment.topic.id }}" id="id_topic">
|
||||
|
||||
<input type="submit" class="block btn btn-primary" value="Speichern">
|
||||
</form>
|
||||
</div>
|
||||
</main>
|
||||
{% endblock %}
|
||||
23
fet2020/templates/intern/attachment/create.html
Normal file
23
fet2020/templates/intern/attachment/create.html
Normal file
@@ -0,0 +1,23 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Anhang Ordner hinzufügen{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<!-- Main Content -->
|
||||
<main class="container mx-auto w-full px-4 my-8 flex-1">
|
||||
<h1 class="page-title">Anhang Ordner hinzufügen</h1>
|
||||
<div class="w-full h-full flex-1 flex justify-center items-center">
|
||||
<form action="" method="POST" enctype="multipart/form-data" class="w-full max-w-prose sm:px-28 sm:py-4 grid grid-cols-1 gap-y-3 sm:gap-y-6 text-gray-900">
|
||||
{% csrf_token %}
|
||||
{% include "baseform/non_field_errors.html" %}
|
||||
|
||||
{% include "baseform/text.html" with field=form.title %}
|
||||
{% include "baseform/body.html" with field=form.description media=form.media %}
|
||||
|
||||
<input type="hidden" name="topic" value="{{ topic.id }}" id="id_topic">
|
||||
|
||||
<input type="submit" class="block btn btn-primary" value="Hinzufügen">
|
||||
</form>
|
||||
</div>
|
||||
</main>
|
||||
{% endblock %}
|
||||
23
fet2020/templates/intern/attachment/update.html
Normal file
23
fet2020/templates/intern/attachment/update.html
Normal file
@@ -0,0 +1,23 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}{{ attachment.title }} bearbeiten{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<!-- Main Content -->
|
||||
<main class="container mx-auto w-full px-4 my-8 flex-1">
|
||||
<h1 class="page-title">Anhang Ordner '{{ attachment.title }}' bearbeiten</h1>
|
||||
<div class="w-full h-full flex-1 flex justify-center items-center">
|
||||
<form action="" method="POST" enctype="multipart/form-data" class="w-full max-w-prose sm:px-28 sm:py-4 grid grid-cols-1 gap-y-3 sm:gap-y-6 text-gray-900">
|
||||
{% csrf_token %}
|
||||
{% include "baseform/non_field_errors.html" %}
|
||||
|
||||
{% include "baseform/text.html" with field=form.title %}
|
||||
{% include "baseform/body.html" with field=form.description media=form.media %}
|
||||
|
||||
<input type="hidden" name="topic" value="{{ attachment.topic.id }}" id="id_topic">
|
||||
|
||||
<input type="submit" class="block btn btn-primary" value="Speichern">
|
||||
</form>
|
||||
</div>
|
||||
</main>
|
||||
{% endblock %}
|
||||
23
fet2020/templates/intern/etherpad/create.html
Normal file
23
fet2020/templates/intern/etherpad/create.html
Normal file
@@ -0,0 +1,23 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Etherpad hinzufügen{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<!-- Main Content -->
|
||||
<main class="container mx-auto w-full px-4 my-8 flex-1">
|
||||
<h1 class="page-title">Etherpad hinzufügen</h1>
|
||||
<div class="w-full h-full flex-1 flex justify-center items-center">
|
||||
<form action="" method="POST" enctype="multipart/form-data" class="w-full max-w-prose sm:px-28 sm:py-4 grid grid-cols-1 gap-y-3 sm:gap-y-6 text-gray-900">
|
||||
{% csrf_token %}
|
||||
{% include "baseform/non_field_errors.html" %}
|
||||
|
||||
{% include "baseform/text.html" with field=form.title %}
|
||||
{% include "baseform/date.html" with field=form.date %}
|
||||
|
||||
<input type="hidden" name="attachment" value="{{ attachment.id }}" id="id_attachment">
|
||||
|
||||
<input type="submit" class="block btn btn-primary" value="Hinzufügen">
|
||||
</form>
|
||||
</div>
|
||||
</main>
|
||||
{% endblock %}
|
||||
@@ -1,42 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Etherpad hinzufügen{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<!-- Main Content -->
|
||||
<main class="container mx-auto w-full px-4 my-8 flex-1">
|
||||
<h1 class="page-title">Etherpad hinzufügen</h1>
|
||||
<div class="w-full h-full flex-1 flex justify-center items-center">
|
||||
<form action="" method="POST" enctype="multipart/form-data" class="w-full max-w-prose sm:px-28 sm:py-4 grid grid-cols-1 gap-y-3 sm:gap-y-6 text-gray-900">
|
||||
{% csrf_token %}
|
||||
|
||||
{% if form.non_field_errors %}
|
||||
<div class="alert alert-danger">
|
||||
<i class="alert-icon fa-solid fa-check-circle"></i>
|
||||
<h2 class="alert-title">Fehler:</h2>
|
||||
<div class="alert-body">{{ form.non_field_errors }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<label class="block">
|
||||
<span class="text-gray-700 dark:text-gray-200">{{ form.title.label }}</span>
|
||||
{% if form.title.errors %}
|
||||
<div class="alert alert-danger">
|
||||
<div class="alert-body">{{ form.title.errors }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<input type="text" id="id_title" name="title" class="mt-1 block w-full rounded-md border-gray-300 dark:border-none shadow-sm focus:border-none focus:ring focus:ring-blue-200 dark:focus:ring-sky-700 focus:ring-opacity-50" required>
|
||||
</label>
|
||||
|
||||
<label>
|
||||
<span class="text-gray-700 dark:text-gray-200">{{ form.date.label }}</span>
|
||||
<input type="date" id="id_date" name="date" class="block w-full mt-1 rounded-md border-gray-300 dark:border-none shadow-sm focus:border-none focus:ring focus:ring-blue-200 dark:focus:ring-sky-700 focus:ring-opacity-50" required>
|
||||
</label>
|
||||
|
||||
<input type="hidden" name="attachment" value="{{ attachment.id }}" id="id_attachment">
|
||||
|
||||
<input type="submit" class="block btn btn-primary" value="Hinzufügen">
|
||||
</form>
|
||||
</div>
|
||||
</main>
|
||||
{% endblock %}
|
||||
@@ -1,48 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Datei hinzufügen{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<!-- Main Content -->
|
||||
<main class="container mx-auto w-full px-4 my-8 flex-1">
|
||||
<h1 class="page-title">Datei hinzufügen</h1>
|
||||
<div class="w-full h-full flex-1 flex justify-center items-center">
|
||||
<form action="" method="POST" enctype="multipart/form-data" class="w-full max-w-prose sm:px-28 sm:py-4 grid grid-cols-1 gap-y-3 sm:gap-y-6 text-gray-900">
|
||||
{% csrf_token %}
|
||||
|
||||
{% if form.non_field_errors %}
|
||||
<div class="alert alert-danger">
|
||||
<i class="alert-icon fa-solid fa-check-circle"></i>
|
||||
<h2 class="alert-title">Fehler:</h2>
|
||||
<div class="alert-body">{{ form.non_field_errors }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<label>
|
||||
<span class="text-gray-700 dark:text-gray-200">{{ form.file_field.label }}</span>
|
||||
{% if form.file_field.errors %}
|
||||
<div class="alert alert-danger">
|
||||
<div class="alert-body">{{ form.file_field.errors }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<input type="file" id="id_file_field" name="file_field" class="text-gray-700 dark:text-gray-200 block w-full mt-1 rounded-md border-gray-300 dark:border-none shadow-sm focus:border-none focus:ring focus:ring-blue-200 dark:focus:ring-sky-700 focus:ring-opacity-50" required>
|
||||
</label>
|
||||
|
||||
<label class="block">
|
||||
<span class="text-gray-700 dark:text-gray-200">{{ form.title.label }}</span>
|
||||
{% if form.title.errors %}
|
||||
<div class="alert alert-danger">
|
||||
<div class="alert-body">{{ form.title.errors }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<input type="text" id="id_title" name="title" class="mt-1 block w-full rounded-md border-gray-300 dark:border-none shadow-sm focus:border-none focus:ring focus:ring-blue-200 dark:focus:ring-sky-700 focus:ring-opacity-50">
|
||||
</label>
|
||||
|
||||
|
||||
<input type="hidden" name="attachment" value="{{ attachment.id }}" id="id_attachment">
|
||||
|
||||
<input type="submit" class="block btn btn-primary" value="Hinzufügen">
|
||||
</form>
|
||||
</div>
|
||||
</main>
|
||||
{% endblock %}
|
||||
23
fet2020/templates/intern/fileupload/create.html
Normal file
23
fet2020/templates/intern/fileupload/create.html
Normal file
@@ -0,0 +1,23 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Datei hinzufügen{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<!-- Main Content -->
|
||||
<main class="container mx-auto w-full px-4 my-8 flex-1">
|
||||
<h1 class="page-title">Datei hinzufügen</h1>
|
||||
<div class="w-full h-full flex-1 flex justify-center items-center">
|
||||
<form action="" method="POST" enctype="multipart/form-data" class="w-full max-w-prose sm:px-28 sm:py-4 grid grid-cols-1 gap-y-3 sm:gap-y-6 text-gray-900">
|
||||
{% csrf_token %}
|
||||
{% include "baseform/non_field_errors.html" %}
|
||||
|
||||
{% include "baseform/file.html" with field=form.file_field %}
|
||||
{% include "baseform/text.html" with field=form.title %}
|
||||
|
||||
<input type="hidden" name="attachment" value="{{ attachment.id }}" id="id_attachment">
|
||||
|
||||
<input type="submit" class="block btn btn-primary" value="Hinzufügen">
|
||||
</form>
|
||||
</div>
|
||||
</main>
|
||||
{% endblock %}
|
||||
23
fet2020/templates/intern/topic/create.html
Normal file
23
fet2020/templates/intern/topic/create.html
Normal file
@@ -0,0 +1,23 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Neues Thema hinzufügen{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<!-- Main Content -->
|
||||
<main class="container mx-auto w-full px-4 my-8 flex-1">
|
||||
<h1 class="page-title">neues Thema hinzufügen</h1>
|
||||
<div class="w-full h-full flex-1 flex justify-center items-center">
|
||||
<form action="" method="POST" enctype="multipart/form-data" class="w-full max-w-prose sm:px-28 sm:py-4 grid grid-cols-1 gap-y-3 sm:gap-y-6 text-gray-900">
|
||||
{% csrf_token %}
|
||||
{% include "baseform/non_field_errors.html" %}
|
||||
|
||||
{% include "baseform/text.html" with field=form.title %}
|
||||
{% include "baseform/body.html" with field=form.description media=form.media %}
|
||||
|
||||
<input type="hidden" name="topic_group" value="{{ topic_group.id }}" id="id_topic_group">
|
||||
|
||||
<input type="submit" class="block btn btn-primary" value="Hinzufügen">
|
||||
</form>
|
||||
</div>
|
||||
</main>
|
||||
{% endblock %}
|
||||
@@ -1,48 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}Neues Thema hinzufügen{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<!-- Main Content -->
|
||||
<main class="container mx-auto w-full px-4 my-8 flex-1">
|
||||
<h1 class="page-title">neues Thema hinzufügen</h1>
|
||||
<div class="w-full h-full flex-1 flex justify-center items-center">
|
||||
<form action="" method="POST" enctype="multipart/form-data" class="w-full max-w-prose sm:px-28 sm:py-4 grid grid-cols-1 gap-y-3 sm:gap-y-6 text-gray-900">
|
||||
{% csrf_token %}
|
||||
|
||||
{% if form.non_field_errors %}
|
||||
<div class="alert alert-danger">
|
||||
<i class="alert-icon fa-solid fa-check-circle"></i>
|
||||
<h2 class="alert-title">Fehler:</h2>
|
||||
<div class="alert-body">{{ form.non_field_errors }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<label class="block">
|
||||
<span class="text-gray-700 dark:text-gray-200">{{ form.title.label }}</span>
|
||||
{% if form.title.errors %}
|
||||
<div class="alert alert-danger">
|
||||
<div class="alert-body">{{ form.title.errors }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<input type="text" id="id_title" name="title" class="mt-1 block w-full rounded-md border-gray-300 dark:border-none shadow-sm focus:border-none focus:ring focus:ring-blue-200 dark:focus:ring-sky-700 focus:ring-opacity-50" required>
|
||||
</label>
|
||||
|
||||
<label class="block">
|
||||
<span class="text-gray-700 dark:text-gray-200">{{ form.description.label }}</span>
|
||||
{% if form.description.errors %}
|
||||
<div class="alert alert-danger">
|
||||
<div class="alert-body">{{ form.description.errors }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{{ form.media }}
|
||||
{{ form.description }}
|
||||
</label>
|
||||
|
||||
<input type="hidden" name="topic_group" value="{{ topic_group.id }}" id="id_topic_group">
|
||||
|
||||
<input type="submit" class="block btn btn-primary" value="Hinzufügen">
|
||||
</form>
|
||||
</div>
|
||||
</main>
|
||||
{% endblock %}
|
||||
@@ -1,51 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}{{ topic.title }} bearbeiten{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<!-- Main Content -->
|
||||
<main class="container mx-auto w-full px-4 my-8 flex-1">
|
||||
<h1 class="page-title">Thema '{{ topic.title }}' bearbeiten</h1>
|
||||
<div class="w-full h-full flex-1 flex justify-center items-center">
|
||||
<form action="" method="POST" enctype="multipart/form-data" class="w-full max-w-prose sm:px-28 sm:py-4 grid grid-cols-1 gap-y-3 sm:gap-y-6 text-gray-900">
|
||||
{% csrf_token %}
|
||||
|
||||
{% if form.non_field_errors %}
|
||||
<div class="alert alert-danger">
|
||||
<i class="alert-icon fa-solid fa-check-circle"></i>
|
||||
<h2 class="alert-title">Fehler:</h2>
|
||||
<div class="alert-body">{{ form.non_field_errors }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<label class="block">
|
||||
<span class="text-gray-700 dark:text-gray-200">{{ form.title.label }}</span>
|
||||
{% if form.title.errors %}
|
||||
<div class="alert alert-danger">
|
||||
<div class="alert-body">{{ form.title.errors }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<input type="text" id="id_title" name="title" value="{{ topic.title }}" class="mt-1 block w-full rounded-md border-gray-300 dark:border-none shadow-sm focus:border-none focus:ring focus:ring-blue-200 dark:focus:ring-sky-700 focus:ring-opacity-50" required>
|
||||
</label>
|
||||
|
||||
<label class="block">
|
||||
<span class="text-gray-700 dark:text-gray-200">{{ form.description.label }}</span>
|
||||
{% if form.description.errors %}
|
||||
<div class="alert alert-danger">
|
||||
<div class="alert-body">{{ form.description.errors }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{{ form.media }}
|
||||
{{ form.description }}
|
||||
</label>
|
||||
|
||||
<input type="hidden" name="topic_group" value="{{ topic.topic_group.id }}" id="id_topic_group">
|
||||
|
||||
<div class="flex flex-col-reverse sm:flex-row gap-3 justify-end pt-4 sm:pt-0">
|
||||
<a href="{% url 'admin:intern_topic_change' topic.id %}" class="block btn btn-secondary-proprietary">Thema im Admin bearbeiten</a>
|
||||
<input type="submit" class="block btn btn-primary" value="Speichern">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</main>
|
||||
{% endblock %}
|
||||
27
fet2020/templates/intern/topic/update.html
Normal file
27
fet2020/templates/intern/topic/update.html
Normal file
@@ -0,0 +1,27 @@
|
||||
{% extends 'base.html' %}
|
||||
|
||||
{% block title %}{{ topic.title }} bearbeiten{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<!-- Main Content -->
|
||||
<main class="container mx-auto w-full px-4 my-8 flex-1">
|
||||
<h1 class="page-title">Thema '{{ topic.title }}' bearbeiten</h1>
|
||||
<div class="w-full h-full flex-1 flex justify-center items-center">
|
||||
<form action="" method="POST" enctype="multipart/form-data" class="w-full max-w-prose sm:px-28 sm:py-4 grid grid-cols-1 gap-y-3 sm:gap-y-6 text-gray-900">
|
||||
{% csrf_token %}
|
||||
|
||||
{% include "baseform/non_field_errors.html" %}
|
||||
|
||||
{% include "baseform/text.html" with field=form.title %}
|
||||
{% include "baseform/body.html" with field=form.description media=form.media %}
|
||||
|
||||
<input type="hidden" name="topic_group" value="{{ topic.topic_group.id }}" id="id_topic_group">
|
||||
|
||||
<div class="flex flex-col-reverse sm:flex-row gap-3 justify-end pt-4 sm:pt-0">
|
||||
<a href="{% url 'admin:intern_topic_change' topic.id %}" class="block btn btn-secondary-proprietary">Thema im Admin bearbeiten</a>
|
||||
<input type="submit" class="block btn btn-primary" value="Speichern">
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</main>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user