Skip to content

Commit

Permalink
Refactor the previous commit a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
atodorov committed Nov 28, 2023
1 parent 31afc71 commit 8a5ff1a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions tcms/testplans/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,8 @@ def get_context_data(self, **kwargs):

def get_form(self, form_class=None):
form = super().get_form(form_class)
if self.request.POST.get("product"):
form.populate(product_pk=self.request.POST["product"])
else:
form.populate(product_pk=self.object.product_id)
product_id = self.request.POST.get("product", self.object.product_id)
form.populate(product_pk=product_id)
return form

def get_form_kwargs(self):
Expand Down

0 comments on commit 8a5ff1a

Please sign in to comment.