Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
api: Convert TestPlan.create() & TestPlan.update() to ModelForm
- Loading branch information
Showing
2 changed files
with
18 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,6 @@ | ||
from django.forms import CharField, ModelChoiceField | ||
from tcms.rpc.api.forms import UpdateModelFormMixin | ||
from tcms.testplans.forms import NewPlanForm | ||
|
||
from tcms.management.models import Product, Version | ||
from tcms.testplans import forms as testplan_forms | ||
from tcms.testplans.models import PlanType | ||
|
||
|
||
# todo: this needs to become a model form with none of the fields required | ||
class NewPlanForm(testplan_forms.NewPlanForm): | ||
class EditPlanForm(UpdateModelFormMixin, NewPlanForm): # pylint: disable=remove-empty-class | ||
pass | ||
|
||
|
||
class EditPlanForm(NewPlanForm): | ||
name = CharField( | ||
required=False | ||
) | ||
type = ModelChoiceField( | ||
queryset=PlanType.objects.all(), | ||
required=False | ||
) | ||
product = ModelChoiceField( | ||
queryset=Product.objects.all(), | ||
required=False, | ||
) | ||
product_version = ModelChoiceField( | ||
queryset=Version.objects.none(), | ||
required=False | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters