class UpdateExecutionForm(UpdateModelFormMixin, forms.ModelForm): class Meta: model = TestExecution fields = "__all__" assignee = UserField() tested_by = UserField() stop_date = DateTimeField() start_date = DateTimeField()
class NewRunForm(forms.ModelForm): class Meta: model = TestRun exclude = ("tag", "cc") # pylint: disable=modelform-uses-exclude manager = UserField() default_tester = UserField(required=False) start_date = DateTimeField(required=False) stop_date = DateTimeField(required=False) planned_start = DateTimeField(required=False) planned_stop = DateTimeField(required=False) case = forms.ModelMultipleChoiceField( queryset=TestCase.objects.none(), required=False, ) product = forms.ModelChoiceField( queryset=Product.objects.all(), required=False, ) matrix_type = forms.ChoiceField( choices=( ("full", _("Full")), ("pairwise", _("Pairwise")), ), required=False, ) environment = forms.ModelMultipleChoiceField( queryset=Environment.objects.all(), required=False, ) def populate(self, plan_id): if plan_id: # plan is ModelChoiceField which contains all the plans # as we need only the plan for current run we filter the queryset self.fields["plan"].queryset = self.fields["plan"].queryset.filter( pk=plan_id) self.fields["product"].queryset = Product.objects.filter( pk=self.fields["plan"].queryset.first().product_id, ) self.fields["build"].queryset = Build.objects.filter( version_id=self.fields["plan"].queryset.first(). product_version_id, is_active=True, ) else: # these are dynamically filtered via JavaScript self.fields["plan"].queryset = self.fields["plan"].queryset.none() self.fields["build"].queryset = Build.objects.none() self.fields["case"].queryset = TestCase.objects.filter( case_status__is_confirmed=True).all()
class UpdateForm(UpdateModelFormMixin, forms.ModelForm): class Meta: model = TestRun exclude = ('tag', 'cc') # pylint: disable=modelform-uses-exclude manager = UserField() default_tester = UserField() start_date = DateTimeField() stop_date = DateTimeField() def populate(self, product_id): self.fields['build'].queryset = Build.objects.filter(product_id=product_id, is_active=True)
class UpdateForm(UpdateModelFormMixin, forms.ModelForm): class Meta: model = TestRun exclude = ("tag", "cc") # pylint: disable=modelform-uses-exclude manager = UserField() default_tester = UserField() start_date = DateTimeField() stop_date = DateTimeField() def populate(self, version_id): self.fields["build"].queryset = Build.objects.filter( version_id=version_id, is_active=True)
class UpdateExecutionForm(UpdateModelFormMixin, forms.ModelForm): class Meta: model = TestExecution fields = '__all__' assignee = UserField() tested_by = UserField() close_date = DateTimeField()