add topic_group-slug to every topic and attachment url

This commit is contained in:
2022-07-30 21:17:48 +00:00
parent 19e58df205
commit 9eb476efe0
7 changed files with 117 additions and 170 deletions

View File

@@ -1,4 +1,4 @@
from django.urls import path from django.urls import include, path
from . import apps from . import apps
from . import views from . import views
@@ -17,43 +17,54 @@ from .views import (
app_name = apps.InternConfig.name app_name = apps.InternConfig.name
urlpatterns = [ attachment_urlpatterns = [
path("", views.index, name="index"),
path( path(
"<slug:topic_group>/topic-create/", "",
TopicCreateView.as_view(),
name="topic-create",
),
path("<slug:slug>/", TopicDetailView.as_view(), name="topic"),
path(
"<slug:slug>/update/",
TopicUpdateView.as_view(),
name="topic-update",
),
path(
"<slug:slug>/attachment-create/",
AttachmentCreateView.as_view(),
name="attachment-create",
),
path("<slug:slug>/create/", TaskCreateView.as_view(), name="task-create"),
path(
"<slug:topic_slug>/<slug:slug>/",
AttachmentDetailView.as_view(), AttachmentDetailView.as_view(),
name="attachment", name="attachment",
), ),
path( path(
"<slug:topic_slug>/<slug:slug>/update/", "update/",
AttachmentUpdateView.as_view(), AttachmentUpdateView.as_view(),
name="attachment-update", name="attachment-update",
), ),
path( path(
"<slug:topic_slug>/<slug:slug>/etherpad-create/", "etherpad-create/",
EtherpadCreateView.as_view(), EtherpadCreateView.as_view(),
name="etherpad-create", name="etherpad-create",
), ),
path( path(
"<slug:topic_slug>/<slug:slug>/file-create/", "file-create/",
FileUploadCreateView.as_view(), FileUploadCreateView.as_view(),
name="file-create", name="file-create",
), ),
] ]
topic_urlpatterns = [
path("", TopicDetailView.as_view(), name="topic"),
path(
"update/",
TopicUpdateView.as_view(),
name="topic-update",
),
path(
"attachment-create/",
AttachmentCreateView.as_view(),
name="attachment-create",
),
path("create/", TaskCreateView.as_view(), name="task-create"),
]
urlpatterns = [
path("", views.index, name="index"),
path(
"<slug:topic_group_slug>/topic-create/",
TopicCreateView.as_view(),
name="topic-create",
),
path("<slug:topic_group_slug>/<slug:slug>/", include(topic_urlpatterns)),
path(
"<slug:topic_group_slug>/<slug:topic_slug>/<slug:slug>/",
include(attachment_urlpatterns),
),
]

View File

@@ -47,12 +47,10 @@ def index(request):
class TopicCreateView(LoginRequiredMixin, CreateView): class TopicCreateView(LoginRequiredMixin, CreateView):
form_class = TopicCreateForm
model = Topic model = Topic
success_url = reverse_lazy("intern:index") success_url = reverse_lazy("intern:index")
template_name = "intern/topic/topic_create.html" template_name = "intern/topic/topic_create.html"
form_class = TopicCreateForm
slug = None
def form_valid(self, form): def form_valid(self, form):
form.instance.created_by = self.request.user form.instance.created_by = self.request.user
@@ -61,75 +59,61 @@ class TopicCreateView(LoginRequiredMixin, CreateView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
context["topic_group"] = TopicGroup.objects.get(slug=self.slug) topic_group_slug = self.kwargs.get("topic_group_slug")
context["topic_group"] = TopicGroup.objects.get(slug=topic_group_slug)
return context return context
def get_initial(self):
self.slug = self.kwargs.get("topic_group")
class TopicDetailView(LoginRequiredMixin, DetailView): class TopicDetailView(LoginRequiredMixin, DetailView):
model = Topic model = Topic
template_name = "intern/topic/topic_detail.html" template_name = "intern/topic/topic_detail.html"
slug = None
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
self.slug = self.object.slug attachments = Attachment.objects.filter(topic=self.object).order_by("title")
active_topic = Topic.objects.get(id=self.object.id)
attachments = Attachment.objects.filter(topic__slug=self.slug).order_by("title")
tasks = None tasks = None
if active_topic.task_list: if self.object.task_list:
tasks = deque( tasks = deque(
Task.taskmanager.get_tasks( Task.taskmanager.get_tasks(
user=None, user=None,
assigned_tasks=True, assigned_tasks=True,
task_list=active_topic.task_list, task_list=self.object.task_list,
completed=False, completed=False,
) )
) )
context = { context["topic"] = self.object
"active_topic": active_topic, context["attachments"] = attachments
"attachments": attachments, context["tasks"] = tasks
"tasks": tasks,
}
return context return context
def get_queryset(self):
topic_group_slug = self.kwargs.get("topic_group_slug")
return Topic.objects.filter(Q(topic_group__slug=topic_group_slug))
class TopicUpdateView(LoginRequiredMixin, UpdateView): class TopicUpdateView(LoginRequiredMixin, UpdateView):
model = Topic model = Topic
template_name = "intern/topic/topic_update.html" template_name = "intern/topic/topic_update.html"
form_class = TopicUpdateForm form_class = TopicUpdateForm
slug = None
def form_valid(self, form): def form_valid(self, form):
form.instance.created_by = self.request.user form.instance.created_by = self.request.user
add_log_action(self.request, form, "intern", "topic", False) add_log_action(self.request, form, "intern", "topic", False)
# get new slug
obj = form.save(commit=False)
self.slug = obj.slug
return super().form_valid(form) return super().form_valid(form)
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
context["slug"] = self.slug context["topic"] = self.object
context["topic"] = Topic.objects.get(slug=self.slug)
return context return context
def get_initial(self):
self.slug = self.kwargs.get("slug")
def get_success_url(self): def get_success_url(self):
context = { context = {
"slug": self.slug, "topic_group_slug": self.object.topic_group.slug,
"slug": self.object.slug,
} }
return reverse("intern:topic", kwargs=context) return reverse("intern:topic", kwargs=context)
@@ -139,8 +123,6 @@ class AttachmentCreateView(LoginRequiredMixin, CreateView):
template_name = "intern/attachment/attachment_create.html" template_name = "intern/attachment/attachment_create.html"
form_class = AttachmentCreateForm form_class = AttachmentCreateForm
slug = None
def form_valid(self, form): def form_valid(self, form):
form.instance.created_by = self.request.user form.instance.created_by = self.request.user
add_log_action(self.request, form, "intern", "attachment", True) add_log_action(self.request, form, "intern", "attachment", True)
@@ -148,28 +130,21 @@ class AttachmentCreateView(LoginRequiredMixin, CreateView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
context["slug"] = self.slug topic_group_slug = self.kwargs.get("topic_group_slug")
context["topic"] = Topic.objects.get(slug=self.slug) topic_slug = self.kwargs.get("slug")
context["topic"] = Topic.objects.get(
Q(topic_group__slug=topic_group_slug) & Q(slug=topic_slug)
)
return context return context
def get_initial(self):
self.slug = self.kwargs.get("slug")
def get_success_url(self): def get_success_url(self):
context = { return reverse("intern:topic", kwargs=self.kwargs)
"slug": self.slug,
}
return reverse("intern:topic", kwargs=context)
class AttachmentDetailView(LoginRequiredMixin, DetailView): class AttachmentDetailView(LoginRequiredMixin, DetailView):
model = Attachment model = Attachment
template_name = "intern/attachment/attachment_detail.html" template_name = "intern/attachment/attachment_detail.html"
topic_slug = None
slug = None
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
response = super().get(request, *args, **kwargs) response = super().get(request, *args, **kwargs)
@@ -183,67 +158,56 @@ class AttachmentDetailView(LoginRequiredMixin, DetailView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
self.topic_slug = self.object.topic.slug context["attachment"] = self.object
self.slug = self.object.slug etherpads = Etherpad.objects.filter(attachment=self.object).order_by("-date")
context["active_topic"] = Topic.objects.get(slug=self.topic_slug)
attachment = Attachment.objects.get(id=self.object.id)
context["attachment"] = attachment
etherpads = Etherpad.objects.filter(attachment=attachment).order_by("-date")
context["etherpads"] = etherpads context["etherpads"] = etherpads
context["files"] = FileUpload.objects.filter(attachment=attachment) context["files"] = FileUpload.objects.filter(attachment=self.object)
return context return context
def get_queryset(self):
topic_group_slug = self.kwargs.get("topic_group_slug")
topic_slug = self.kwargs.get("topic_slug")
return Attachment.objects.filter(
Q(topic__topic_group__slug=topic_group_slug) & Q(topic__slug=topic_slug)
)
class AttachmentUpdateView(LoginRequiredMixin, UpdateView): class AttachmentUpdateView(LoginRequiredMixin, UpdateView):
form_class = AttachmentUpdateForm
model = Attachment model = Attachment
template_name = "intern/attachment/attachment_update.html" template_name = "intern/attachment/attachment_update.html"
form_class = AttachmentUpdateForm
topic_slug = None
slug = None
def form_valid(self, form): def form_valid(self, form):
form.instance.created_by = self.request.user form.instance.created_by = self.request.user
add_log_action(self.request, form, "intern", "attachment", False) add_log_action(self.request, form, "intern", "attachment", False)
# get new slug
obj = form.save(commit=False)
self.slug = obj.slug
return super().form_valid(form) return super().form_valid(form)
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
context["topic"] = Topic.objects.get(slug=self.topic_slug) context["attachment"] = self.object
attachment = Attachment.objects.get(
Q(slug=self.slug) & Q(topic__slug=self.topic_slug)
)
context["attachment"] = attachment
return context return context
def get_initial(self): def get_queryset(self):
self.topic_slug = self.kwargs.get("topic_slug") topic_group_slug = self.kwargs.get("topic_group_slug")
self.slug = self.kwargs.get("slug") topic_slug = self.kwargs.get("topic_slug")
return Attachment.objects.filter(
Q(topic__topic_group__slug=topic_group_slug) & Q(topic__slug=topic_slug)
)
def get_success_url(self): def get_success_url(self):
context = { context = {
"topic_slug": self.topic_slug, "topic_group_slug": self.object.topic.topic_group.slug,
"slug": self.slug, "topic_slug": self.object.topic.slug,
"slug": self.object.slug,
} }
return reverse("intern:attachment", kwargs=context) return reverse("intern:attachment", kwargs=context)
class EtherpadCreateView(LoginRequiredMixin, CreateView): class EtherpadCreateView(LoginRequiredMixin, CreateView):
form_class = EtherpadForm
model = Etherpad model = Etherpad
template_name = "intern/etherpad_create.html" template_name = "intern/etherpad_create.html"
form_class = EtherpadForm
topic_slug = None
slug = None
def form_valid(self, form): def form_valid(self, form):
form.instance.created_by = self.request.user form.instance.created_by = self.request.user
@@ -252,35 +216,25 @@ class EtherpadCreateView(LoginRequiredMixin, CreateView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
context["topic_slug"] = self.topic_slug topic_group_slug = self.kwargs.get("topic_group_slug")
context["slug"] = self.slug topic_slug = self.kwargs.get("topic_slug")
slug = self.kwargs.get("slug")
attachment = Attachment.objects.get( attachment = Attachment.objects.get(
Q(slug=self.slug) & Q(topic__slug=self.topic_slug) Q(topic__topic_group__slug=topic_group_slug)
& Q(topic__slug=topic_slug)
& Q(slug=slug)
) )
context["attachment"] = attachment context["attachment"] = attachment
return context return context
def get_initial(self):
self.topic_slug = self.kwargs.get("topic_slug")
self.slug = self.kwargs.get("slug")
def get_success_url(self): def get_success_url(self):
context = { return reverse("intern:attachment", kwargs=self.kwargs)
"topic_slug": self.topic_slug,
"slug": self.slug,
}
return reverse("intern:attachment", kwargs=context)
class FileUploadCreateView(LoginRequiredMixin, CreateView): class FileUploadCreateView(LoginRequiredMixin, CreateView):
form_class = FileUploadForm
model = FileUpload model = FileUpload
template_name = "intern/file_create.html" template_name = "intern/file_create.html"
form_class = FileUploadForm
topic_slug = None
slug = None
def form_valid(self, form): def form_valid(self, form):
form.instance.created_by = self.request.user form.instance.created_by = self.request.user
@@ -289,34 +243,25 @@ class FileUploadCreateView(LoginRequiredMixin, CreateView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
context["topic_slug"] = self.topic_slug topic_group_slug = self.kwargs.get("topic_group_slug")
context["slug"] = self.slug topic_slug = self.kwargs.get("topic_slug")
slug = self.kwargs.get("slug")
attachment = Attachment.objects.get( attachment = Attachment.objects.get(
Q(slug=self.slug) & Q(topic__slug=self.topic_slug) Q(topic__topic_group__slug=topic_group_slug)
& Q(topic__slug=topic_slug)
& Q(slug=slug)
) )
context["attachment"] = attachment context["attachment"] = attachment
return context return context
def get_initial(self):
self.topic_slug = self.kwargs.get("topic_slug")
self.slug = self.kwargs.get("slug")
def get_success_url(self): def get_success_url(self):
context = { return reverse("intern:attachment", kwargs=self.kwargs)
"topic_slug": self.topic_slug,
"slug": self.slug,
}
return reverse("intern:attachment", kwargs=context)
class TaskCreateView(LoginRequiredMixin, CreateView): class TaskCreateView(LoginRequiredMixin, CreateView):
form_class = InternTaskCreateForm
model = Task model = Task
template_name = "intern/task_create.html" template_name = "intern/task_create.html"
form_class = InternTaskCreateForm
slug = None
def form_valid(self, form): def form_valid(self, form):
form.instance.created_by = self.request.user form.instance.created_by = self.request.user
@@ -325,19 +270,10 @@ class TaskCreateView(LoginRequiredMixin, CreateView):
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs) context = super().get_context_data(**kwargs)
context["slug"] = self.slug slug = self.kwargs.get("slug")
topic = Topic.objects.get(slug=slug)
topic = Topic.objects.get(slug=self.slug)
context["topic"] = topic context["topic"] = topic
context["task_list"] = topic.task_list
return context return context
def get_initial(self):
self.slug = self.kwargs.get("slug")
def get_success_url(self): def get_success_url(self):
context = { return reverse("intern:topic", kwargs=self.kwargs)
"slug": self.slug,
}
return reverse("intern:topic", kwargs=context)

View File

@@ -8,9 +8,9 @@
<h1 class="page-title">Intern</h1> <h1 class="page-title">Intern</h1>
<div class="flex flex-col gap-y-4 max-w-prose mx-auto text-gray-700 dark:text-gray-300"> <div class="flex flex-col gap-y-4 max-w-prose mx-auto text-gray-700 dark:text-gray-300">
<aside class="flex gap-2 flex-wrap align-bottom text-sm sm:text-base text-gray-600 dark:text-gray-300"> <aside class="flex gap-2 flex-wrap align-bottom text-sm sm:text-base text-gray-600 dark:text-gray-300">
<a class="underline hover:text-gray-900 dark:hover:text-gray-100" href="{% url 'intern:index' %}#{{ active_topic.topic_group.slug }}">{{ active_topic.topic_group.title }}</a> <a class="underline hover:text-gray-900 dark:hover:text-gray-100" href="{% url 'intern:index' %}#{{ attachment.topic.topic_group.slug }}">{{ attachment.topic.topic_group.title }}</a>
<span><i class="fa-solid fa-angle-right"></i></span> <span><i class="fa-solid fa-angle-right"></i></span>
<a class="underline hover:text-gray-900 dark:hover:text-gray-100" href="{% url 'intern:topic' active_topic.slug %}">{{ active_topic.title }}</a> <a class="underline hover:text-gray-900 dark:hover:text-gray-100" href="{% url 'intern:topic' attachment.topic.topic_group.slug attachment.topic.slug %}">{{ attachment.topic.title }}</a>
<span><i class="fa-solid fa-angle-right"></i></span> <span><i class="fa-solid fa-angle-right"></i></span>
<span class="cursor-default">{{ attachment.title }}</span> <span class="cursor-default">{{ attachment.title }}</span>
</aside> </aside>
@@ -29,7 +29,7 @@
</a> --> </a> -->
</div> </div>
<div class="documentList rounded divide-y divide-gray-300 dark:divide-gray-600"> <div class="documentList rounded divide-y divide-gray-300 dark:divide-gray-600">
<a href="{% url 'intern:etherpad-create' active_topic.slug attachment.slug %}" class="flex justify-between"> <a href="{% url 'intern:etherpad-create' attachment.topic.topic_group.slug attachment.topic.slug attachment.slug %}" class="flex justify-between">
<h3 class="text-gray-800 dark:text-gray-200"><i class="fa-solid fa-plus fa-fw mr-1"></i>Neues Etherpad erstellen</h2> <h3 class="text-gray-800 dark:text-gray-200"><i class="fa-solid fa-plus fa-fw mr-1"></i>Neues Etherpad erstellen</h2>
</a> </a>
@@ -45,7 +45,7 @@
<section> <section>
<h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">Dokumente:</h2> <h2 class="text-lg font-medium text-gray-900 dark:text-gray-100">Dokumente:</h2>
<div class="documentList rounded divide-y divide-gray-300 dark:divide-gray-600"> <div class="documentList rounded divide-y divide-gray-300 dark:divide-gray-600">
<a href="{% url 'intern:file-create' active_topic.slug attachment.slug %}" class="flex justify-between"> <a href="{% url 'intern:file-create' attachment.topic.topic_group.slug attachment.topic.slug attachment.slug %}" class="flex justify-between">
<h3 class="text-gray-800 dark:text-gray-200"><i class="fa-solid fa-plus fa-fw mr-1"></i>Neues Dokument hochladen</h2> <h3 class="text-gray-800 dark:text-gray-200"><i class="fa-solid fa-plus fa-fw mr-1"></i>Neues Dokument hochladen</h2>
</a> </a>
@@ -58,7 +58,7 @@
</div> </div>
</section> </section>
<a href="{% url 'intern:attachment-update' active_topic.slug attachment.slug %}" class="btn btn-primary block place-self-end"><i class="fa-solid fa-pen-to-square mr-2"></i>Beschreibung bearbeiten</a> <a href="{% url 'intern:attachment-update' attachment.topic.topic_group.slug attachment.topic.slug attachment.slug %}" class="btn btn-primary block place-self-end"><i class="fa-solid fa-pen-to-square mr-2"></i>Beschreibung bearbeiten</a>
</div> </div>
</main> </main>
{% endblock %} {% endblock %}

View File

@@ -39,7 +39,7 @@
{{ form.description }} {{ form.description }}
</label> </label>
<input type="hidden" name="topic" value="{{ topic.id }}" id="id_topic"> <input type="hidden" name="topic" value="{{ attachment.topic.id }}" id="id_topic">
<input type="submit" class="block btn btn-primary" value="Bearbeiten"> <input type="submit" class="block btn btn-primary" value="Bearbeiten">
</form> </form>

View File

@@ -29,7 +29,7 @@
</div> </div>
<ul class="ml-7 w-fit" x-show="expandList" x-collapse> <ul class="ml-7 w-fit" x-show="expandList" x-collapse>
{% for topic in topic_group.list %} {% for topic in topic_group.list %}
<li><a href="{% url 'intern:topic' topic.slug %}" class="w-full py-1 inline-block">{{ topic.title }}</a></li> <li><a href="{% url 'intern:topic' topic.topic_group.slug topic.slug %}" class="w-full py-1 inline-block">{{ topic.title }}</a></li>
{% endfor %} {% endfor %}
<li class="py-1"> <li class="py-1">
<a href="{% url 'intern:topic-create' topic_group.grouper.slug %}" class="border border-gray-700 dark:border-gray-300 rounded px-1.5 py-1 text-sm sm:hidden"> <a href="{% url 'intern:topic-create' topic_group.grouper.slug %}" class="border border-gray-700 dark:border-gray-300 rounded px-1.5 py-1 text-sm sm:hidden">
@@ -81,7 +81,7 @@
</div> </div>
<ul class="ml-7 w-fit" x-show="expandList" x-collapse> <ul class="ml-7 w-fit" x-show="expandList" x-collapse>
{% for topic in archive_topic %} {% for topic in archive_topic %}
<li><a href="{% url 'intern:topic' topic.slug %}" class="w-full py-1 inline-block">{{ topic.title }}</a></li> <li><a href="{% url 'intern:topic' topic.topic_group.slug topic.slug %}" class="w-full py-1 inline-block">{{ topic.title }}</a></li>
{% endfor %} {% endfor %}
</ul> </ul>
</section> </section>

View File

@@ -51,7 +51,7 @@
</select> </select>
</label> </label>
<input type="hidden" name="task_list" value="{{ task_list.id }}" id="id_task_list"> <input type="hidden" name="task_list" value="{{ topic.task_list.id }}" id="id_task_list">
<input type="submit" class="block btn btn-primary" value="Hinzufügen"> <input type="submit" class="block btn btn-primary" value="Hinzufügen">
</form> </form>

View File

@@ -1,6 +1,6 @@
{% extends "base.html" %} {% extends "base.html" %}
{% block title %}{{ active_topic.title }}{% endblock %} {% block title %}{{ topic.title }}{% endblock %}
{% block content %} {% block content %}
<!-- Main Content --> <!-- Main Content -->
@@ -8,14 +8,14 @@
<h1 class="page-title">Intern</h1> <h1 class="page-title">Intern</h1>
<div class="flex flex-col gap-y-8 max-w-prose mx-auto text-gray-700 dark:text-gray-300"> <div class="flex flex-col gap-y-8 max-w-prose mx-auto text-gray-700 dark:text-gray-300">
<aside class="flex gap-2 flex-wrap align-bottom text-sm sm:text-base text-gray-600 dark:text-gray-300"> <aside class="flex gap-2 flex-wrap align-bottom text-sm sm:text-base text-gray-600 dark:text-gray-300">
<a class="underline hover:text-gray-900 dark:hover:text-gray-100" href="{% url 'intern:index' %}#{{ active_topic.topic_group.slug }}">{{ active_topic.topic_group.title }}</a> <a class="underline hover:text-gray-900 dark:hover:text-gray-100" href="{% url 'intern:index' %}#{{ topic.topic_group.slug }}">{{ topic.topic_group.title }}</a>
<span><i class="fa-solid fa-angle-right"></i></span> <span><i class="fa-solid fa-angle-right"></i></span>
<span class="cursor-default">{{ active_topic.title }}</span> <span class="cursor-default">{{ topic.title }}</span>
</aside> </aside>
{% if active_topic.description %} {% if topic.description %}
<div class="db-page-content-left"> <div class="db-page-content-left">
{{ active_topic.description|safe }} {{ topic.description|safe }}
</div> </div>
{% endif %} {% endif %}
@@ -32,20 +32,20 @@
<ul class="flex flex-col gap-1 max-w-fit"> <ul class="flex flex-col gap-1 max-w-fit">
{% for attachment in attachments %} {% for attachment in attachments %}
<li><a href="{% url 'intern:attachment' active_topic.slug attachment.slug %}" class="py-1 inline-block">{{ attachment.title }}</a></li> <li><a href="{% url 'intern:attachment' topic.topic_group.slug topic.slug attachment.slug %}" class="py-1 inline-block">{{ attachment.title }}</a></li>
{% endfor %} {% endfor %}
<li class="mt-2"> <li class="mt-2">
<a href="{% url 'intern:attachment-create' active_topic.slug %}" class="border border-gray-700 dark:border-gray-300 rounded px-1.5 py-1"> <a href="{% url 'intern:attachment-create' topic.topic_group.slug topic.slug %}" class="border border-gray-700 dark:border-gray-300 rounded px-1.5 py-1">
<i class="fa-solid fa-plus mr-1"></i>Eintrag hinzufügen <i class="fa-solid fa-plus mr-1"></i>Eintrag hinzufügen
</a> </a>
</li> </li>
</ul> </ul>
<section class="flex flex-col sm:flex-row justify-end gap-4"> <section class="flex flex-col sm:flex-row justify-end gap-4">
<a href="{% url 'intern:topic-update' active_topic.slug %}" class="btn btn-primary block"><i class="fa-solid fa-pen-to-square mr-2"></i>Thema bearbeiten</a> <a href="{% url 'intern:topic-update' topic.topic_group.slug topic.slug %}" class="btn btn-primary block"><i class="fa-solid fa-pen-to-square mr-2"></i>Thema bearbeiten</a>
{% if active_topic.task_list %} {% if topic.task_list %}
<a href="{% url 'intern:task-create' active_topic.slug %}" class="btn btn-primary block"><i class="fa-solid fa-plus-square mr-2"></i>Task hinzufügen</a> <a href="{% url 'intern:task-create' topic.topic_group.slug topic.slug %}" class="btn btn-primary block"><i class="fa-solid fa-plus-square mr-2"></i>Task hinzufügen</a>
{% endif %} {% endif %}
</section> </section>
</div> </div>