Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Make parent a hidden field in category form

Marcin Gębalaedc5c77eca4e
diff --git a/saleor/dashboard/category/forms.py b/saleor/dashboard/category/forms.py
index e219cae187..75fb4b060c 100644
--- a/saleor/dashboard/category/forms.py
+++ b/saleor/dashboard/category/forms.py
@@ -9,7 +9,7 @@ from ...product.models import Category
class CategoryForm(forms.ModelForm):
parent = TreeNodeChoiceField(queryset=Category.objects.all(),
- required=False)
+ required=False, widget=forms.HiddenInput())
def __init__(self, *args, **kwargs):
super(CategoryForm, self).__init__(*args, **kwargs)
diff --git a/saleor/dashboard/templates/dashboard/category/detail.html b/saleor/dashboard/templates/dashboard/category/detail.html
index 1a5abeb164..d956b8a0b4 100644
--- a/saleor/dashboard/templates/dashboard/category/detail.html
+++ b/saleor/dashboard/templates/dashboard/category/detail.html
@@ -29,6 +29,7 @@
<div class="row">
<div class="col l8">
<div class="row">
+ {{ form.parent }}
{{ form.name|materializecss:"s8 m10" }}
{{ form.hidden|materializecss:"s4 m2" }}
{{ form.description|materializecss }}
diff --git a/saleor/dashboard/templates/dashboard/category/list.html b/saleor/dashboard/templates/dashboard/category/list.html
index db903ea01f..57c3c9f5a1 100644
--- a/saleor/dashboard/templates/dashboard/category/list.html
+++ b/saleor/dashboard/templates/dashboard/category/list.html
@@ -134,6 +134,7 @@
<h5>{% trans "Edit" %} {{ root }}</h5>
<div class="row">
+ {{ form.parent }}
{{ form.name|materializecss:"s8 m10" }}
{{ form.hidden|materializecss:"s4 m2" }}
{{ form.description|materializecss }}