Commit 2f4a7017 authored by VAN ZUIJLEN Nils's avatar VAN ZUIJLEN Nils
Browse files

Code style

parent e57045c5
...@@ -406,7 +406,7 @@ class OrderEditViewTest(OrderItemTestCase): ...@@ -406,7 +406,7 @@ class OrderEditViewTest(OrderItemTestCase):
@user_logged_in @user_logged_in
def test_context_data_user(self) -> None: def test_context_data_user(self) -> None:
url = reverse('boutique:order_edit') url = reverse("boutique:order_edit")
# Empty order # Empty order
resp = self.client.get(url) resp = self.client.get(url)
...@@ -449,12 +449,14 @@ class OrderEditViewTest(OrderItemTestCase): ...@@ -449,12 +449,14 @@ class OrderEditViewTest(OrderItemTestCase):
self.assertIn("total_price", context) self.assertIn("total_price", context)
self.assertIn("is_contributor", context) self.assertIn("is_contributor", context)
self.assertEqual(context["total_price"], cotiz.price_contributor + item.price_contributor) self.assertEqual(
context["total_price"], cotiz.price_contributor + item.price_contributor
)
self.assertTrue(context["is_contributor"]) self.assertTrue(context["is_contributor"])
@contrib_user_logged_in @contrib_user_logged_in
def test_context_data_contrib_user(self) -> None: def test_context_data_contrib_user(self) -> None:
url = reverse('boutique:order_edit') url = reverse("boutique:order_edit")
# Empty order # Empty order
resp = self.client.get(url) resp = self.client.get(url)
...@@ -497,7 +499,9 @@ class OrderEditViewTest(OrderItemTestCase): ...@@ -497,7 +499,9 @@ class OrderEditViewTest(OrderItemTestCase):
self.assertIn("total_price", context) self.assertIn("total_price", context)
self.assertIn("is_contributor", context) self.assertIn("is_contributor", context)
self.assertEqual(context["total_price"], cotiz.price_contributor + item.price_contributor) self.assertEqual(
context["total_price"], cotiz.price_contributor + item.price_contributor
)
self.assertTrue(context["is_contributor"]) self.assertTrue(context["is_contributor"])
......
...@@ -323,9 +323,10 @@ class OrderEditView(LoginRequiredMixin, UpdateView): ...@@ -323,9 +323,10 @@ class OrderEditView(LoginRequiredMixin, UpdateView):
self.object.compute_price() self.object.compute_price()
kwargs["total_price"] = self.object.price kwargs["total_price"] = self.object.price
kwargs["is_contributor"] = bde.models.Contributor.is_contributor( kwargs["is_contributor"] = (
self.request.user bde.models.Contributor.is_contributor(self.request.user)
) or self.object.contains_cotiz or self.object.contains_cotiz
)
return kwargs return kwargs
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment