Skip to content

Commit

Permalink
Replace obsolete EditPlanForm. Fixes kiwitcms#677
Browse files Browse the repository at this point in the history
It is merged with NewPlanForm
  • Loading branch information
asankov committed Jan 2, 2019
1 parent d6c846d commit 2b73c78
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
15 changes: 4 additions & 11 deletions tcms/testplans/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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
)
Expand Down
5 changes: 2 additions & 3 deletions tcms/testplans/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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,
Expand Down

0 comments on commit 2b73c78

Please sign in to comment.