From b9dfc5c40cdb8253810011fb4bfb2f7ed74cd136 Mon Sep 17 00:00:00 2001 From: Justus Perlwitz Date: Thu, 9 Jan 2025 11:13:42 +0900 Subject: [PATCH] BE: Continue sub task update view --- .../templates/workspace/task_update.html | 172 +++++++++--------- .../task_update/sub_task_update.html | 3 + backend/projectify/workspace/views/task.py | 6 +- docs/remove-fe-worklog.md | 10 +- 4 files changed, 100 insertions(+), 91 deletions(-) diff --git a/backend/projectify/workspace/templates/workspace/task_update.html b/backend/projectify/workspace/templates/workspace/task_update.html index dc2399ab6..5fcd70bb3 100644 --- a/backend/projectify/workspace/templates/workspace/task_update.html +++ b/backend/projectify/workspace/templates/workspace/task_update.html @@ -30,99 +30,99 @@ > {{ task.section.title }} - > New task (currently creating) - - -
- - + > {{ task.title }}
-
- - - - - + + + + + + +
{{ form.title.label_tag }} +
+ + +
+ +
+ + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - -
{{ form.title.label_tag }} +
+
{{ form.title }}
+
+
{{ form.assignee.label_tag }}{{ form.assignee }}
{{ form.labels.label_tag }}{{ form.labels }}
{{ form.due_date.label_tag }} +
-
{{ form.title }}
-
-
{{ form.assignee.label_tag }}{{ form.assignee }}
{{ form.labels.label_tag }}{{ form.labels }}
{{ form.due_date.label_tag }} -
-
-
- -
+
+
-
{{ form.description.label_tag }}{{ form.description }}
-
-
-
-

Sub tasks

-
- -
- -
+
+
{{ form.description.label_tag }}{{ form.description }}
+
+
+
+

Sub tasks

+
+ +
+
-
{% include "workspace/task_update/sub_task_update.html" with formset=formset %}
- {{ formset.management_form }} - {% csrf_token %} +
{% include "workspace/task_update/sub_task_update.html" with formset=formset %}
+ {{ formset.management_form }} + {% csrf_token %}
- + + {% endblock dashboard_content %} diff --git a/backend/projectify/workspace/templates/workspace/task_update/sub_task_update.html b/backend/projectify/workspace/templates/workspace/task_update/sub_task_update.html index 2012c2abc..250e13e72 100644 --- a/backend/projectify/workspace/templates/workspace/task_update/sub_task_update.html +++ b/backend/projectify/workspace/templates/workspace/task_update/sub_task_update.html @@ -12,6 +12,9 @@
{{ form.title }}
+ {% endfor %} diff --git a/backend/projectify/workspace/views/task.py b/backend/projectify/workspace/views/task.py index a26bc0296..09fc01e91 100644 --- a/backend/projectify/workspace/views/task.py +++ b/backend/projectify/workspace/views/task.py @@ -282,7 +282,7 @@ def task_update_view( "title": f["title"], "done": f["done"], "_order": i, - "uuid": UUID(f["uuid"]), + "uuid": f["uuid"], } for i, f in enumerate(formset.cleaned_data) ] @@ -301,10 +301,8 @@ def task_update_view( ) if cleaned_data["submit_stay"]: n = reverse("dashboard:tasks:detail", args=(task.uuid,)) - elif cleaned_data["submit"]: - n = reverse("dashboard:projects:detail", args=(project.uuid,)) else: - raise ValueError(cleaned_data) + n = reverse("dashboard:projects:detail", args=(project.uuid,)) return redirect(n) diff --git a/docs/remove-fe-worklog.md b/docs/remove-fe-worklog.md index 39f05f261..caf7429d1 100644 --- a/docs/remove-fe-worklog.md +++ b/docs/remove-fe-worklog.md @@ -435,5 +435,13 @@ to call things what they are instead. Gotta think on this one. ## 2025-01-9 -Today I try to finish the formset -> sub task update conversion and make the +Today I finished the formset -> sub task update conversion and make the basic use case 1. "Make it possible to update existing sub tasks" work. + +There are no error messages or anything right now. + +I can use this + +https://docs.djangoproject.com/en/5.1/topics/forms/#looping-over-the-form-s-fields + +and make the template for the form a bit more maintainable. This is the way.