From 2b73c781309dac4d341003512ed533a6aefa0ba5 Mon Sep 17 00:00:00 2001 From: asankov Date: Tue, 1 Jan 2019 22:41:36 +0200 Subject: [PATCH] Replace obsolete EditPlanForm. Fixes #677 It is merged with NewPlanForm --- tcms/testplans/forms.py | 15 ++++----------- tcms/testplans/views.py | 5 ++--- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/tcms/testplans/forms.py b/tcms/testplans/forms.py index 2f9c25f971..ee74ab61cd 100644 --- a/tcms/testplans/forms.py +++ b/tcms/testplans/forms.py @@ -3,8 +3,8 @@ from tcms.core.widgets import SimpleMDE from tcms.core.utils import string_to_list -from tcms.core.forms.fields import UserField, StripURLField -from tcms.management.models import Product, Version, Tag +from tcms.core.forms.fields import StripURLField +from tcms.management.models import Product, Version from .models import TestPlan, PlanType @@ -87,13 +87,6 @@ class NewPlanForm(BasePlanForm): is_active = forms.BooleanField(label="Active", required=False, initial=True) -class EditPlanForm(NewPlanForm): - author = UserField( - label=' plan\'s author', - required=False - ) - - # =========== Forms for search/filter ============== class SearchPlanForm(forms.Form): @@ -200,11 +193,11 @@ class ClonePlanForm(BasePlanForm): # =========== Forms for XML-RPC functions ============== -class XMLRPCNewPlanForm(EditPlanForm): +class XMLRPCNewPlanForm(NewPlanForm): text = forms.CharField() -class XMLRPCEditPlanForm(EditPlanForm): +class XMLRPCEditPlanForm(NewPlanForm): name = forms.CharField( label="Plan name", required=False ) diff --git a/tcms/testplans/views.py b/tcms/testplans/views.py index b31e61036a..336738d19f 100644 --- a/tcms/testplans/views.py +++ b/tcms/testplans/views.py @@ -27,7 +27,6 @@ from tcms.testcases.views import get_selected_testcases from tcms.testcases.views import printable as testcases_printable from tcms.testplans.forms import ClonePlanForm -from tcms.testplans.forms import EditPlanForm from tcms.testplans.forms import NewPlanForm from tcms.testplans.forms import SearchPlanForm from tcms.testplans.models import TestPlan, PlanType @@ -287,7 +286,7 @@ def edit(request, plan_id, template_name='plan/edit.html'): # If the form is submitted if request.method == "POST": - form = EditPlanForm(request.POST) + form = NewPlanForm(request.POST) form.populate(product_id=request.POST.get('product')) # FIXME: Error handle @@ -313,7 +312,7 @@ def edit(request, plan_id, template_name='plan/edit.html'): return HttpResponseRedirect( reverse('test_plan_url', args=[plan_id, slugify(test_plan.name)])) else: - form = EditPlanForm(initial={ + form = NewPlanForm(initial={ 'name': test_plan.name, 'product': test_plan.product_id, 'product_version': test_plan.product_version_id,