Skip to content
This repository has been archived by the owner on Nov 4, 2024. It is now read-only.

Django Oscar Upgrade to version 3.2 #4064

Merged
merged 23 commits into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
4626bd8
chore: django oscar version upgrade to 3.1
zubair-ce07 Nov 12, 2023
a8acca8
fix: changed django migration to alter price field in stockrecord model
zubair-ce07 Nov 12, 2023
6f0b745
Merge branch 'master' into zubair-django-oscar31-update
zubair-ce07 Nov 14, 2023
28f8cb6
feat: add data migration to make voucher names unique
mumarkhan999 Nov 14, 2023
bd96751
fix: removed code
zubair-ce07 Nov 15, 2023
d56b082
Merge branch 'zubair-django-oscar31-update' of github.com:openedx/eco…
zubair-ce07 Nov 15, 2023
4ef8517
Merge branch 'master' into zubair-django-oscar31-update
zubair-ce07 Nov 15, 2023
cad553c
refactor: updated django oscar templates
zubair-ce07 Nov 16, 2023
ef3a5c4
Merge branch 'zubair-django-oscar31-update' of github.com:openedx/eco…
zubair-ce07 Nov 16, 2023
c68378a
Merge branch 'master' into zubair-django-oscar31-update
zubair-ce07 Nov 16, 2023
8fbe9ab
Merge branch 'master' into zubair-django-oscar31-update
zubair-ce07 Dec 5, 2023
3e6b2e6
refactor: updated price field name
zubair-ce07 Dec 5, 2023
e3860eb
refactor: update price field name
zubair-ce07 Dec 5, 2023
5345248
chore: PR to upgrade django oscar to version 3.2
zubair-ce07 Dec 5, 2023
8f96306
feat: resloved reserved keywords conflict
zubair-ce07 Dec 5, 2023
375c449
feat: add data mmigration to make basket_lineattribute value json com…
mumarkhan999 Dec 7, 2023
b2aa8b7
Merge branch 'master' into zubair-django-oscar31-update
zubair-ce07 Jan 8, 2024
d3ea7c0
feat: added refund functionality
zubair-ce07 Jan 12, 2024
935f5ee
Merge branch 'zubair-django-oscar31-update' into zubair-django-oscar3…
zubair-ce07 Jan 15, 2024
0c20f67
Merge branch 'master' into zubair-django-oscar32-update
zubair-ce07 Jan 16, 2024
fa555b9
Merge branch 'master' into zubair-django-oscar32-update
zubair-ce07 Jan 24, 2024
5e90f5c
Merge branch 'master' into zubair-django-oscar32-update
zubair-ce07 Jan 25, 2024
8e944b0
feat: add data mmigration to make order_lineattribute value json comp…
mumarkhan999 Jan 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions db_keyword_overrides.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,10 @@ MYSQL:
- ShippingEvent.lines
- PaymentEvent.lines
- ProductAlert.key
- HistoricalOption.order
- Option.order
SNOWFLAKE:
- HistoricalOption.order
- Option.order

STITCH:
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# -*- coding: utf-8 -*-
from django.core.paginator import Paginator
from django.db import migrations

Check warning on line 3 in ecommerce/extensions/basket/migrations/0016_make_lineattribute_value_json_compatible.py

View check run for this annotation

Codecov / codecov/patch

ecommerce/extensions/basket/migrations/0016_make_lineattribute_value_json_compatible.py#L2-L3

Added lines #L2 - L3 were not covered by tests


def make_lineattribute_value_json_compatible(apps, schema_editor):

Check warning on line 6 in ecommerce/extensions/basket/migrations/0016_make_lineattribute_value_json_compatible.py

View check run for this annotation

Codecov / codecov/patch

ecommerce/extensions/basket/migrations/0016_make_lineattribute_value_json_compatible.py#L6

Added line #L6 was not covered by tests
"""
Makes line attribute value json compatible.
"""
LineAttribute = apps.get_model("basket", "LineAttribute")
attributes = LineAttribute.objects.order_by('id')
paginator = Paginator(attributes, 1000)

Check warning on line 12 in ecommerce/extensions/basket/migrations/0016_make_lineattribute_value_json_compatible.py

View check run for this annotation

Codecov / codecov/patch

ecommerce/extensions/basket/migrations/0016_make_lineattribute_value_json_compatible.py#L10-L12

Added lines #L10 - L12 were not covered by tests

for page_number in paginator.page_range:
page = paginator.page(page_number)
updates = []

Check warning on line 16 in ecommerce/extensions/basket/migrations/0016_make_lineattribute_value_json_compatible.py

View check run for this annotation

Codecov / codecov/patch

ecommerce/extensions/basket/migrations/0016_make_lineattribute_value_json_compatible.py#L14-L16

Added lines #L14 - L16 were not covered by tests

for obj in page.object_list:
obj.value = '"{}"'.format(obj.value)
updates.append(obj)

Check warning on line 20 in ecommerce/extensions/basket/migrations/0016_make_lineattribute_value_json_compatible.py

View check run for this annotation

Codecov / codecov/patch

ecommerce/extensions/basket/migrations/0016_make_lineattribute_value_json_compatible.py#L18-L20

Added lines #L18 - L20 were not covered by tests

LineAttribute.objects.bulk_update(updates, ['value'])

Check warning on line 22 in ecommerce/extensions/basket/migrations/0016_make_lineattribute_value_json_compatible.py

View check run for this annotation

Codecov / codecov/patch

ecommerce/extensions/basket/migrations/0016_make_lineattribute_value_json_compatible.py#L22

Added line #L22 was not covered by tests


class Migration(migrations.Migration):

Check warning on line 25 in ecommerce/extensions/basket/migrations/0016_make_lineattribute_value_json_compatible.py

View check run for this annotation

Codecov / codecov/patch

ecommerce/extensions/basket/migrations/0016_make_lineattribute_value_json_compatible.py#L25

Added line #L25 was not covered by tests

dependencies = [

Check warning on line 27 in ecommerce/extensions/basket/migrations/0016_make_lineattribute_value_json_compatible.py

View check run for this annotation

Codecov / codecov/patch

ecommerce/extensions/basket/migrations/0016_make_lineattribute_value_json_compatible.py#L27

Added line #L27 was not covered by tests
('basket', '0015_add_paymentintentid'),
]

operations = [

Check warning on line 31 in ecommerce/extensions/basket/migrations/0016_make_lineattribute_value_json_compatible.py

View check run for this annotation

Codecov / codecov/patch

ecommerce/extensions/basket/migrations/0016_make_lineattribute_value_json_compatible.py#L31

Added line #L31 was not covered by tests
migrations.RunPython(make_lineattribute_value_json_compatible, migrations.RunPython.noop),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 3.2.20 on 2023-12-05 10:34

import django.core.serializers.json
from django.db import migrations, models

Check warning on line 4 in ecommerce/extensions/basket/migrations/0017_alter_lineattribute_value.py

View check run for this annotation

Codecov / codecov/patch

ecommerce/extensions/basket/migrations/0017_alter_lineattribute_value.py#L3-L4

Added lines #L3 - L4 were not covered by tests


class Migration(migrations.Migration):

Check warning on line 7 in ecommerce/extensions/basket/migrations/0017_alter_lineattribute_value.py

View check run for this annotation

Codecov / codecov/patch

ecommerce/extensions/basket/migrations/0017_alter_lineattribute_value.py#L7

Added line #L7 was not covered by tests

dependencies = [

Check warning on line 9 in ecommerce/extensions/basket/migrations/0017_alter_lineattribute_value.py

View check run for this annotation

Codecov / codecov/patch

ecommerce/extensions/basket/migrations/0017_alter_lineattribute_value.py#L9

Added line #L9 was not covered by tests
('basket', '0016_make_lineattribute_value_json_compatible'),
]

operations = [

Check warning on line 13 in ecommerce/extensions/basket/migrations/0017_alter_lineattribute_value.py

View check run for this annotation

Codecov / codecov/patch

ecommerce/extensions/basket/migrations/0017_alter_lineattribute_value.py#L13

Added line #L13 was not covered by tests
migrations.AlterField(
model_name='lineattribute',
name='value',
field=models.JSONField(encoder=django.core.serializers.json.DjangoJSONEncoder, verbose_name='Value'),
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Generated by Django 3.2.20 on 2023-12-05 10:34

from django.db import migrations, models
import django.db.models.deletion
import oscar.models.fields.slugfield

Check warning on line 5 in ecommerce/extensions/catalogue/migrations/0057_auto_20231205_1034.py

View check run for this annotation

Codecov / codecov/patch

ecommerce/extensions/catalogue/migrations/0057_auto_20231205_1034.py#L3-L5

Added lines #L3 - L5 were not covered by tests


class Migration(migrations.Migration):

Check warning on line 8 in ecommerce/extensions/catalogue/migrations/0057_auto_20231205_1034.py

View check run for this annotation

Codecov / codecov/patch

ecommerce/extensions/catalogue/migrations/0057_auto_20231205_1034.py#L8

Added line #L8 was not covered by tests

dependencies = [

Check warning on line 10 in ecommerce/extensions/catalogue/migrations/0057_auto_20231205_1034.py

View check run for this annotation

Codecov / codecov/patch

ecommerce/extensions/catalogue/migrations/0057_auto_20231205_1034.py#L10

Added line #L10 was not covered by tests
('catalogue', '0056_auto_20231108_1355'),
]

operations = [

Check warning on line 14 in ecommerce/extensions/catalogue/migrations/0057_auto_20231205_1034.py

View check run for this annotation

Codecov / codecov/patch

ecommerce/extensions/catalogue/migrations/0057_auto_20231205_1034.py#L14

Added line #L14 was not covered by tests
migrations.AlterModelOptions(
name='option',
options={'ordering': ['order', 'name'], 'verbose_name': 'Option', 'verbose_name_plural': 'Options'},
),
migrations.AddField(
model_name='historicaloption',
name='help_text',
field=models.CharField(blank=True, help_text='Help text shown to the user on the add to basket form', max_length=255, null=True, verbose_name='Help text'),
),
migrations.AddField(
model_name='historicaloption',
name='option_group',
field=models.ForeignKey(blank=True, db_constraint=False, help_text='Select an option group if using type "Option" or "Multi Option"', null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='catalogue.attributeoptiongroup', verbose_name='Option Group'),
),
migrations.AddField(
model_name='historicaloption',
name='order',
field=models.IntegerField(blank=True, db_index=True, help_text='Controls the ordering of product options on product detail pages', null=True, verbose_name='Ordering'),
),
migrations.AddField(
model_name='option',
name='help_text',
field=models.CharField(blank=True, help_text='Help text shown to the user on the add to basket form', max_length=255, null=True, verbose_name='Help text'),
),
migrations.AddField(
model_name='option',
name='option_group',
field=models.ForeignKey(blank=True, help_text='Select an option group if using type "Option" or "Multi Option"', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='product_options', to='catalogue.attributeoptiongroup', verbose_name='Option Group'),
),
migrations.AddField(
model_name='option',
name='order',
field=models.IntegerField(blank=True, db_index=True, help_text='Controls the ordering of product options on product detail pages', null=True, verbose_name='Ordering'),
),
migrations.AlterField(
model_name='historicaloption',
name='type',
field=models.CharField(choices=[('text', 'Text'), ('integer', 'Integer'), ('boolean', 'True / False'), ('float', 'Float'), ('date', 'Date'), ('select', 'Select'), ('radio', 'Radio'), ('multi_select', 'Multi select'), ('checkbox', 'Checkbox')], default='text', max_length=255, verbose_name='Type'),
),
migrations.AlterField(
model_name='historicalproduct',
name='slug',
field=oscar.models.fields.slugfield.SlugField(allow_unicode=True, max_length=255, verbose_name='Slug'),
),
migrations.AlterField(
model_name='option',
name='type',
field=models.CharField(choices=[('text', 'Text'), ('integer', 'Integer'), ('boolean', 'True / False'), ('float', 'Float'), ('date', 'Date'), ('select', 'Select'), ('radio', 'Radio'), ('multi_select', 'Multi select'), ('checkbox', 'Checkbox')], default='text', max_length=255, verbose_name='Type'),
),
migrations.AlterField(
model_name='product',
name='slug',
field=oscar.models.fields.slugfield.SlugField(allow_unicode=True, max_length=255, verbose_name='Slug'),
),
migrations.AlterUniqueTogether(
name='productattribute',
unique_together={('code', 'product_class')},
),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# -*- coding: utf-8 -*-
from django.core.paginator import Paginator
from django.db import migrations

Check warning on line 3 in ecommerce/extensions/order/migrations/0027_make_lineattribute_value_json_compatible.py

View check run for this annotation

Codecov / codecov/patch

ecommerce/extensions/order/migrations/0027_make_lineattribute_value_json_compatible.py#L2-L3

Added lines #L2 - L3 were not covered by tests


def make_lineattribute_value_json_compatible(apps, schema_editor):

Check warning on line 6 in ecommerce/extensions/order/migrations/0027_make_lineattribute_value_json_compatible.py

View check run for this annotation

Codecov / codecov/patch

ecommerce/extensions/order/migrations/0027_make_lineattribute_value_json_compatible.py#L6

Added line #L6 was not covered by tests
"""
Makes line attribute value json compatible.
"""
LineAttribute = apps.get_model("order", "LineAttribute")
attributes = LineAttribute.objects.order_by('id')
paginator = Paginator(attributes, 1000)

Check warning on line 12 in ecommerce/extensions/order/migrations/0027_make_lineattribute_value_json_compatible.py

View check run for this annotation

Codecov / codecov/patch

ecommerce/extensions/order/migrations/0027_make_lineattribute_value_json_compatible.py#L10-L12

Added lines #L10 - L12 were not covered by tests

for page_number in paginator.page_range:
page = paginator.page(page_number)
updates = []

Check warning on line 16 in ecommerce/extensions/order/migrations/0027_make_lineattribute_value_json_compatible.py

View check run for this annotation

Codecov / codecov/patch

ecommerce/extensions/order/migrations/0027_make_lineattribute_value_json_compatible.py#L14-L16

Added lines #L14 - L16 were not covered by tests

for obj in page.object_list:
obj.value = '"{}"'.format(obj.value)
updates.append(obj)

Check warning on line 20 in ecommerce/extensions/order/migrations/0027_make_lineattribute_value_json_compatible.py

View check run for this annotation

Codecov / codecov/patch

ecommerce/extensions/order/migrations/0027_make_lineattribute_value_json_compatible.py#L18-L20

Added lines #L18 - L20 were not covered by tests

LineAttribute.objects.bulk_update(updates, ['value'])

Check warning on line 22 in ecommerce/extensions/order/migrations/0027_make_lineattribute_value_json_compatible.py

View check run for this annotation

Codecov / codecov/patch

ecommerce/extensions/order/migrations/0027_make_lineattribute_value_json_compatible.py#L22

Added line #L22 was not covered by tests


class Migration(migrations.Migration):

Check warning on line 25 in ecommerce/extensions/order/migrations/0027_make_lineattribute_value_json_compatible.py

View check run for this annotation

Codecov / codecov/patch

ecommerce/extensions/order/migrations/0027_make_lineattribute_value_json_compatible.py#L25

Added line #L25 was not covered by tests

dependencies = [

Check warning on line 27 in ecommerce/extensions/order/migrations/0027_make_lineattribute_value_json_compatible.py

View check run for this annotation

Codecov / codecov/patch

ecommerce/extensions/order/migrations/0027_make_lineattribute_value_json_compatible.py#L27

Added line #L27 was not covered by tests
('order', '0026_auto_20231108_1355'),
]

operations = [

Check warning on line 31 in ecommerce/extensions/order/migrations/0027_make_lineattribute_value_json_compatible.py

View check run for this annotation

Codecov / codecov/patch

ecommerce/extensions/order/migrations/0027_make_lineattribute_value_json_compatible.py#L31

Added line #L31 was not covered by tests
migrations.RunPython(make_lineattribute_value_json_compatible, migrations.RunPython.noop),
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Generated by Django 3.2.20 on 2023-12-05 10:34

import django.core.serializers.json
from django.db import migrations, models

Check warning on line 4 in ecommerce/extensions/order/migrations/0028_alter_lineattribute_value.py

View check run for this annotation

Codecov / codecov/patch

ecommerce/extensions/order/migrations/0028_alter_lineattribute_value.py#L3-L4

Added lines #L3 - L4 were not covered by tests


class Migration(migrations.Migration):

Check warning on line 7 in ecommerce/extensions/order/migrations/0028_alter_lineattribute_value.py

View check run for this annotation

Codecov / codecov/patch

ecommerce/extensions/order/migrations/0028_alter_lineattribute_value.py#L7

Added line #L7 was not covered by tests

dependencies = [

Check warning on line 9 in ecommerce/extensions/order/migrations/0028_alter_lineattribute_value.py

View check run for this annotation

Codecov / codecov/patch

ecommerce/extensions/order/migrations/0028_alter_lineattribute_value.py#L9

Added line #L9 was not covered by tests
('order', '0027_make_lineattribute_value_json_compatible'),
]

operations = [

Check warning on line 13 in ecommerce/extensions/order/migrations/0028_alter_lineattribute_value.py

View check run for this annotation

Codecov / codecov/patch

ecommerce/extensions/order/migrations/0028_alter_lineattribute_value.py#L13

Added line #L13 was not covered by tests
migrations.AlterField(
model_name='lineattribute',
name='value',
field=models.JSONField(encoder=django.core.serializers.json.DjangoJSONEncoder, verbose_name='Value'),
),
]
2 changes: 1 addition & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ django-libsass==0.9
# via -r requirements/base.in
django-model-utils==4.3.1
# via edx-rbac
django-oscar==3.1
django-oscar==3.2
# via
# -c requirements/constraints.txt
# -r requirements/base.in
Expand Down
2 changes: 1 addition & 1 deletion requirements/constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
cybersource-rest-client-python==0.0.21

# Django 3.2 support is added in version 2.2 so pinning it to 2.2
django-oscar==3.1
django-oscar==3.2

# Pinned because transifex-client==0.13.6 pins it
urllib3>=1.24.2,<2.0.0
Expand Down
2 changes: 1 addition & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ django-model-utils==4.3.1
# via
# -r requirements/test.txt
# edx-rbac
django-oscar==3.1
django-oscar==3.2
# via -r requirements/test.txt
django-phonenumber-field==5.0.0
# via
Expand Down
2 changes: 1 addition & 1 deletion requirements/production.txt
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ django-libsass==0.9
# via -r requirements/base.in
django-model-utils==4.3.1
# via edx-rbac
django-oscar==3.1
django-oscar==3.2
# via
# -c requirements/constraints.txt
# -r requirements/base.in
Expand Down
2 changes: 1 addition & 1 deletion requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ django-model-utils==4.3.1
# via
# -r requirements/base.txt
# edx-rbac
django-oscar==3.1
django-oscar==3.2
# via
# -c requirements/constraints.txt
# -r requirements/base.txt
Expand Down
Loading