Commit 15c09977 authored by VAN ZUIJLEN Nils's avatar VAN ZUIJLEN Nils
Browse files

Merge branch 'fix-migration-issue-after-add-options' into 'master'

Remove migrations and make one big migration, because inconsistencies were detected from 0017

See merge request !49
parents 72b03bf3 2f4a7017
# Generated by Django 2.2.16 on 2020-11-27 10:24
from django.db import migrations
from django.db import models
class Migration(migrations.Migration):
replaces = [
("boutique", "0017_auto_20201117_1842"),
("boutique", "0018_auto_20201117_1936"),
("boutique", "0019_auto_20201117_2156"),
("boutique", "0020_auto_20201117_2231"),
("boutique", "0021_auto_20201117_2234"),
("boutique", "0022_auto_20201122_2052"),
]
dependencies = [
("boutique", "0016_auto_20200904_2132"),
]
operations = [
migrations.AddField(
model_name="item",
name="customization",
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name="item",
name="option",
field=models.CharField(blank=True, default="", max_length=255),
),
migrations.AddField(
model_name="item",
name="option_label",
field=models.CharField(blank=True, default="", max_length=255),
),
migrations.AddField(
model_name="item",
name="second_option",
field=models.CharField(blank=True, default="", max_length=255),
),
migrations.AddField(
model_name="item",
name="second_option_label",
field=models.CharField(blank=True, default="", max_length=255),
),
migrations.AddField(
model_name="orderitem",
name="customization",
field=models.CharField(blank=True, default="", max_length=255),
),
migrations.AddField(
model_name="orderitem",
name="option",
field=models.CharField(blank=True, default="", max_length=255),
),
migrations.AddField(
model_name="orderitem",
name="second_option",
field=models.CharField(blank=True, default="", max_length=255),
),
]
...@@ -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