Skip to content

Commit e14a56d

Browse files
committed
fix: Hide approval step fields from student submission form
Fields with approval_step set are now excluded from the DynamicForm during initial submission. These fields should only appear during the approval process, not when students fill out the form. Bump version to 0.7.1
1 parent a96cab3 commit e14a56d

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

django_forms_workflows/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
Enterprise-grade, database-driven form builder with approval workflows
44
"""
55

6-
__version__ = "0.7.0"
6+
__version__ = "0.7.1"
77
__author__ = "Django Forms Workflows Contributors"
88
__license__ = "LGPL-3.0-only"
99

django_forms_workflows/forms.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,11 @@ def __init__(self, form_definition, user=None, initial_data=None, *args, **kwarg
3636
self.user = user
3737

3838
# Build form fields from definition
39-
for field in form_definition.fields.exclude(field_type="section").order_by(
40-
"order"
39+
# Exclude fields with approval_step set - those are for approvers only
40+
for field in (
41+
form_definition.fields.exclude(field_type="section")
42+
.filter(approval_step__isnull=True)
43+
.order_by("order")
4144
):
4245
self.add_field(field, initial_data)
4346

@@ -46,9 +49,11 @@ def __init__(self, form_definition, user=None, initial_data=None, *args, **kwarg
4649
self.helper.form_method = "post"
4750
self.helper.form_class = "needs-validation"
4851

49-
# Build layout
52+
# Build layout - exclude approval step fields
5053
layout_fields = []
51-
for field in form_definition.fields.order_by("order"):
54+
for field in form_definition.fields.filter(approval_step__isnull=True).order_by(
55+
"order"
56+
):
5257
if field.field_type == "section":
5358
layout_fields.append(
5459
HTML(f'<h3 class="mt-4 mb-3">{field.field_label}</h3>')

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "django-forms-workflows"
3-
version = "0.7.0"
3+
version = "0.7.1"
44
description = "Enterprise-grade, database-driven form builder with approval workflows and external data integration"
55
license = "LGPL-3.0-only"
66
readme = "README.md"

0 commit comments

Comments
 (0)