diff --git a/fet2020/intern/admin.py b/fet2020/intern/admin.py index 647085d1..46f67fe1 100644 --- a/fet2020/intern/admin.py +++ b/fet2020/intern/admin.py @@ -1,15 +1,15 @@ from django.contrib import admin from django.db.models import F -from .models import TopicGroup, Topic, Documentation, Etherpad, FileUpload +from .models import TopicGroup, Topic, Attachment, Etherpad, FileUpload from .forms import ( TopicGroupAdminForm, TopicAdminForm, - DocumentationAdminForm, + AttachmentAdminForm, EtherpadAdminForm, FileUploadAdminForm, TopicInlineForm, - DocumentationInlineForm, + AttachmentInlineForm, EtherpadInlineForm, FileUploadInlineForm, ) @@ -25,12 +25,12 @@ class TopicInline(admin.TabularInline): readonly_fields = ("slug",) -class DocumentationInline(admin.TabularInline): - model = Documentation - form = DocumentationInlineForm +class AttachmentInline(admin.TabularInline): + model = Attachment + form = AttachmentInlineForm extra = 0 - verbose_name = "Dokumentation" - verbose_name_plural = "Dokumentation-Übersicht" + verbose_name = "Anhang Ordner" + verbose_name_plural = "Anhang Ordner" readonly_fields = ("slug",) @@ -122,7 +122,7 @@ class TopicAdmin(admin.ModelAdmin): }, ), ) - inlines = (DocumentationInline,) + inlines = (AttachmentInline,) list_filter = ["topic_group", "archive"] list_display = ["title", "topic_group", "archive"] @@ -152,9 +152,9 @@ class TopicAdmin(admin.ModelAdmin): super().save_model(request, obj, form, change) -class DocumentationAdmin(admin.ModelAdmin): - form = DocumentationAdminForm - model = Documentation +class AttachmentAdmin(admin.ModelAdmin): + form = AttachmentAdminForm + model = Attachment readonly_fields = ("slug",) fieldsets = ( @@ -211,12 +211,12 @@ class EtherpadAdmin(admin.ModelAdmin): model = Etherpad list_filter = [ - "documentation", + "attachment", ] list_display = [ "title", "date", - "documentation", + "attachment", ] ordering = ["-date"] @@ -249,11 +249,11 @@ class FileUploadAdmin(admin.ModelAdmin): model = FileUpload list_filter = [ - "documentation", + "attachment", ] list_display = [ "title", - "documentation", + "attachment", ] def add_view(self, request, form_url="", extra_context=None): @@ -282,6 +282,6 @@ class FileUploadAdmin(admin.ModelAdmin): admin.site.register(TopicGroup, TopicGroupAdmin) admin.site.register(Topic, TopicAdmin) -admin.site.register(Documentation, DocumentationAdmin) +admin.site.register(Attachment, AttachmentAdmin) admin.site.register(Etherpad, EtherpadAdmin) admin.site.register(FileUpload, FileUploadAdmin) diff --git a/fet2020/intern/forms.py b/fet2020/intern/forms.py index d7410395..344f2e9f 100644 --- a/fet2020/intern/forms.py +++ b/fet2020/intern/forms.py @@ -4,7 +4,7 @@ from django.forms.widgets import HiddenInput from django.utils.translation import gettext_lazy as _ from tasks.models import Task, TaskList -from .models import TopicGroup, Topic, Documentation, Etherpad, FileUpload +from .models import TopicGroup, Topic, Attachment, Etherpad, FileUpload class DateInput(forms.DateInput): @@ -48,9 +48,9 @@ class TopicAdminForm(forms.ModelForm): widgets = {"description": CKEditorUploadingWidget(config_name="default")} -class DocumentationAdminForm(forms.ModelForm): +class AttachmentAdminForm(forms.ModelForm): class Meta: - model = Documentation + model = Attachment fields = "__all__" labels = { @@ -73,7 +73,7 @@ class EtherpadAdminForm(forms.ModelForm): fields = [ "title", "date", - "documentation", + "attachment", ] @@ -83,7 +83,7 @@ class FileUploadAdminForm(forms.ModelForm): fields = [ "title", "file_field", - "documentation", + "attachment", ] @@ -103,9 +103,9 @@ class TopicInlineForm(forms.ModelForm): } -class DocumentationInlineForm(forms.ModelForm): +class AttachmentInlineForm(forms.ModelForm): class Meta: - model = Documentation + model = Attachment fields = [ "title", "shortterm", @@ -125,7 +125,7 @@ class EtherpadInlineForm(forms.ModelForm): fields = [ "title", "date", - "documentation", + "attachment", ] labels = { @@ -189,9 +189,9 @@ class TopicUpdateForm(forms.ModelForm): } -class DocumentationCreateForm(forms.ModelForm): +class AttachmentCreateForm(forms.ModelForm): class Meta: - model = Documentation + model = Attachment fields = [ "title", @@ -211,9 +211,9 @@ class DocumentationCreateForm(forms.ModelForm): } -class DocumentationUpdateForm(forms.ModelForm): +class AttachmentUpdateForm(forms.ModelForm): class Meta: - model = Documentation + model = Attachment fields = [ "title", @@ -240,7 +240,7 @@ class EtherpadForm(forms.ModelForm): fields = [ "title", "date", - "documentation", + "attachment", ] labels = { @@ -250,7 +250,7 @@ class EtherpadForm(forms.ModelForm): widgets = { "date": DateInput(format=("%Y-%m-%d")), - "documentation": HiddenInput, + "attachment": HiddenInput, } @@ -260,9 +260,9 @@ class FileUploadForm(forms.ModelForm): fields = [ "title", "file_field", - "documentation", + "attachment", ] widgets = { - "documentation": HiddenInput, + "attachment": HiddenInput, } diff --git a/fet2020/intern/models.py b/fet2020/intern/models.py index 5d6762c2..e6cb74ea 100644 --- a/fet2020/intern/models.py +++ b/fet2020/intern/models.py @@ -83,7 +83,7 @@ class Topic(models.Model): super().save(*args, **kwargs) -class Documentation(models.Model): +class Attachment(models.Model): title = models.CharField(verbose_name="Titel", max_length=128) shortterm = models.CharField(max_length=10, unique=True) @@ -96,8 +96,8 @@ class Documentation(models.Model): objects = models.Manager() class Meta: - verbose_name = "Dokumentation" - verbose_name_plural = "3. Dokumentationen" + verbose_name = "Anhang Ordner" + verbose_name_plural = "3. Anhang Ordner" constraints = [ UniqueConstraint(fields=["slug", "topic"], name="unique_intern_slug_topic"), @@ -115,7 +115,7 @@ class Documentation(models.Model): "slug": self.slug, } - return reverse("intern:docu", kwargs=kwargs) + return reverse("intern:attachment", kwargs=kwargs) def save(self, *args, **kwargs): if not self.slug: @@ -131,7 +131,7 @@ class Etherpad(models.Model): etherpad_key = models.CharField(max_length=50, blank=True) date = models.DateField(verbose_name="Datum", default=date.today) - documentation = models.ForeignKey(Documentation, on_delete=models.CASCADE) + attachment = models.ForeignKey(Attachment, on_delete=models.CASCADE) objects = models.Manager() @@ -141,7 +141,7 @@ class Etherpad(models.Model): constraints = [ UniqueConstraint( - fields=["title", "date", "documentation"], name="unique_intern_etherpad" + fields=["title", "date", "attachment"], name="unique_intern_etherpad" ), ] @@ -149,9 +149,9 @@ class Etherpad(models.Model): return ( slugify(self.date) + "-" - + self.documentation.topic.slug + + self.attachment.topic.slug + "-" - + self.documentation.slug + + self.attachment.slug + "-" + self.slug ) @@ -187,7 +187,7 @@ class FileUpload(models.Model): ) date = models.DateField(verbose_name="Datum", default=date.today) - documentation = models.ForeignKey(Documentation, on_delete=models.CASCADE) + attachment = models.ForeignKey(Attachment, on_delete=models.CASCADE) objects = models.Manager() diff --git a/fet2020/intern/urls.py b/fet2020/intern/urls.py index 11a166f1..97aa7e64 100644 --- a/fet2020/intern/urls.py +++ b/fet2020/intern/urls.py @@ -3,8 +3,8 @@ from django.urls import path from . import apps from . import views from .views import ( - DocumentationCreateView, - DocumentationUpdateView, + AttachmentCreateView, + AttachmentUpdateView, EtherpadCreateView, FileUploadCreateView, TaskCreateView, @@ -29,16 +29,16 @@ urlpatterns = [ name="topic-update", ), path( - "/docu-create/", - DocumentationCreateView.as_view(), - name="docu-create", + "/attachment-create/", + AttachmentCreateView.as_view(), + name="attachment-create", ), path("/create/", TaskCreateView.as_view(), name="task-create"), - path("//", views.show_docu, name="docu"), + path("//", views.show_attachment, name="attachment"), path( "//update/", - DocumentationUpdateView.as_view(), - name="docu-update", + AttachmentUpdateView.as_view(), + name="attachment-update", ), path( "//etherpad-create/", diff --git a/fet2020/intern/views.py b/fet2020/intern/views.py index 6eb8ebfc..ecb0b2a8 100644 --- a/fet2020/intern/views.py +++ b/fet2020/intern/views.py @@ -15,14 +15,14 @@ from documents.etherpadlib import add_ep_cookie from tasks.forms import InternTaskCreateForm from tasks.models import Task from .forms import ( - DocumentationCreateForm, - DocumentationUpdateForm, + AttachmentCreateForm, + AttachmentUpdateForm, EtherpadForm, FileUploadForm, TopicCreateForm, TopicUpdateForm, ) -from .models import TopicGroup, Topic, Documentation, Etherpad, FileUpload +from .models import TopicGroup, Topic, Attachment, Etherpad, FileUpload logger = logging.getLogger(__name__) @@ -50,7 +50,7 @@ def show_topic(request, slug=None): if not active_topic: raise Http404("wrong topic") - docu = Documentation.objects.filter(topic__slug=slug).order_by("title") + attachments = Attachment.objects.filter(topic__slug=slug).order_by("title") tasks = None if active_topic.task_list: @@ -65,7 +65,7 @@ def show_topic(request, slug=None): context = { "active_topic": active_topic, - "docus": docu, + "attachments": attachments, "tasks": tasks, } @@ -73,12 +73,12 @@ def show_topic(request, slug=None): @authenticated_user -def show_docu(request, topic_slug=None, slug=None): - active_docu = Documentation.objects.filter( +def show_attachment(request, topic_slug=None, slug=None): + attachment = Attachment.objects.filter( Q(topic__slug=topic_slug) & Q(slug=slug) ).first() - if not active_docu: - raise Http404("wrong docu") + if not attachment: + raise Http404("wrong attachment") active_topic = Topic.objects.filter(slug=topic_slug).first() @@ -106,20 +106,20 @@ def show_docu(request, topic_slug=None, slug=None): messages.info(request, "; ".join(elem)) initial = { - "documentation": active_docu, + "attachment": attachment, } form_add_etherpad = EtherpadForm(initial=initial) form_add_file = FileUploadForm(initial=initial) - files = FileUpload.objects.filter(documentation=active_docu) + files = FileUpload.objects.filter(attachment=attachment) - docus = Etherpad.objects.filter(documentation=active_docu).order_by("-date") - etherpads = deque([]) + etherpads = Etherpad.objects.filter(attachment=attachment).order_by("-date") + etherpad_list = deque([]) # list of etherpad url-link of any etherpads - for elem in docus: - etherpads.append( + for elem in etherpads: + etherpad_list.append( { "title": elem.title, "date": elem.date, @@ -131,12 +131,12 @@ def show_docu(request, topic_slug=None, slug=None): "form_add_etherpad": form_add_etherpad, "form_add_file": form_add_file, "active_topic": active_topic, - "active_docu": active_docu, - "documents": etherpads, + "attachment": attachment, + "etherpads": etherpad_list, "files": files, } - response = render(request, "intern/docu.html", context) + response = render(request, "intern/attachment.html", context) try: response = add_ep_cookie(request, response) @@ -200,10 +200,10 @@ class TopicUpdateView(LoginRequiredMixin, UpdateView): return reverse("intern:topic", kwargs=context) -class DocumentationCreateView(LoginRequiredMixin, CreateView): - model = Documentation - template_name = "intern/docu/docu_create.html" - form_class = DocumentationCreateForm +class AttachmentCreateView(LoginRequiredMixin, CreateView): + model = Attachment + template_name = "intern/attachment/attachment_create.html" + form_class = AttachmentCreateForm slug = None @@ -230,10 +230,10 @@ class DocumentationCreateView(LoginRequiredMixin, CreateView): return reverse("intern:topic", kwargs=context) -class DocumentationUpdateView(LoginRequiredMixin, UpdateView): - model = Documentation - template_name = "intern/docu/docu_update.html" - form_class = DocumentationUpdateForm +class AttachmentUpdateView(LoginRequiredMixin, UpdateView): + model = Attachment + template_name = "intern/attachment/attachment_update.html" + form_class = AttachmentUpdateForm topic_slug = None slug = None @@ -248,9 +248,9 @@ class DocumentationUpdateView(LoginRequiredMixin, UpdateView): self.topic_slug = self.kwargs.get("topic_slug") self.slug = self.kwargs.get("slug") - active_docu = Documentation.objects.filter(slug=self.slug).first() + attachment = Attachment.objects.filter(slug=self.slug).first() context = { - "documentation": active_docu, + "attachment": attachment, } return context @@ -261,7 +261,7 @@ class DocumentationUpdateView(LoginRequiredMixin, UpdateView): "slug": self.slug, } - return reverse("intern:docu", kwargs=context) + return reverse("intern:attachment", kwargs=context) class EtherpadCreateView(LoginRequiredMixin, CreateView): @@ -282,9 +282,9 @@ class EtherpadCreateView(LoginRequiredMixin, CreateView): self.topic_slug = self.kwargs.get("topic_slug") self.slug = self.kwargs.get("slug") - active_docu = Documentation.objects.filter(slug=self.slug).first() + attachment = Attachment.objects.filter(slug=self.slug).first() context = { - "documentation": active_docu, + "attachment": attachment, } return context @@ -295,7 +295,7 @@ class EtherpadCreateView(LoginRequiredMixin, CreateView): "slug": self.slug, } - return reverse("intern:docu", kwargs=context) + return reverse("intern:attachment", kwargs=context) class FileUploadCreateView(LoginRequiredMixin, CreateView): @@ -317,9 +317,9 @@ class FileUploadCreateView(LoginRequiredMixin, CreateView): self.topic_slug = self.kwargs.get("topic_slug") self.slug = self.kwargs.get("slug") - active_docu = Documentation.objects.filter(slug=self.kwargs.get("slug")).first() + attachment = Attachment.objects.filter(slug=self.kwargs.get("slug")).first() context = { - "documentation": active_docu, + "attachment": attachment, } return context @@ -330,7 +330,7 @@ class FileUploadCreateView(LoginRequiredMixin, CreateView): "slug": self.slug, } - return reverse("intern:docu", kwargs=context) + return reverse("intern:attachment", kwargs=context) class TaskCreateView(LoginRequiredMixin, CreateView): diff --git a/fet2020/templates/intern/docu.html b/fet2020/templates/intern/attachment.html similarity index 81% rename from fet2020/templates/intern/docu.html rename to fet2020/templates/intern/attachment.html index 1ce074b6..fefe4fa7 100644 --- a/fet2020/templates/intern/docu.html +++ b/fet2020/templates/intern/attachment.html @@ -7,7 +7,7 @@

{{ active_topic.topic_group.title }} / {{ active_topic.title }} - / {{ active_docu.title }} + / {{ attachment.title }}

@@ -17,14 +17,14 @@ {% if request.user.is_authenticated %} {% endif %} - {% if active_docu.description %} + {% if attachment.description %}
- {{ active_docu.description|safe }} + {{ attachment.description|safe }}
{% endif %} @@ -32,7 +32,7 @@
Etherpad Dokumente: - +

+ neues Etherpad erstellen

@@ -40,21 +40,21 @@
- {% for document in documents %} - + {% for etherpad in etherpads %} +
-

{{ document.title }}

+

{{ etherpad.title }}

-

{{ document.date }}

+

{{ etherpad.date }}

{% endfor %} Dokumente: - +

+ neue Datei hochladen

diff --git a/fet2020/templates/intern/docu/docu_create.html b/fet2020/templates/intern/attachment/attachment_create.html similarity index 93% rename from fet2020/templates/intern/docu/docu_create.html rename to fet2020/templates/intern/attachment/attachment_create.html index 769ecb74..4c163d9b 100644 --- a/fet2020/templates/intern/docu/docu_create.html +++ b/fet2020/templates/intern/attachment/attachment_create.html @@ -9,7 +9,7 @@

-

Neue Dokumentation erstellen

+

Neuen Anhang Ordner erstellen

diff --git a/fet2020/templates/intern/docu/docu_update.html b/fet2020/templates/intern/attachment/attachment_update.html similarity index 67% rename from fet2020/templates/intern/docu/docu_update.html rename to fet2020/templates/intern/attachment/attachment_update.html index a37790a7..36ee2cd0 100644 --- a/fet2020/templates/intern/docu/docu_update.html +++ b/fet2020/templates/intern/attachment/attachment_update.html @@ -4,15 +4,15 @@

-

Dokumentation '{{ documentation.title }}' bearbeiten

+

Anhang Ordner '{{ attachment.title }}' bearbeiten

diff --git a/fet2020/templates/intern/etherpad_create.html b/fet2020/templates/intern/etherpad_create.html index b9c0ae3e..e4779a89 100644 --- a/fet2020/templates/intern/etherpad_create.html +++ b/fet2020/templates/intern/etherpad_create.html @@ -4,7 +4,7 @@

diff --git a/fet2020/templates/intern/file_create.html b/fet2020/templates/intern/file_create.html index 1439509c..15fc8942 100644 --- a/fet2020/templates/intern/file_create.html +++ b/fet2020/templates/intern/file_create.html @@ -4,7 +4,7 @@

diff --git a/fet2020/templates/intern/topic.html b/fet2020/templates/intern/topic.html index 12cf20e9..202d9bea 100644 --- a/fet2020/templates/intern/topic.html +++ b/fet2020/templates/intern/topic.html @@ -44,12 +44,12 @@ {% endif %}