From 80b4b430150ea882383c45605b69770f17db9026 Mon Sep 17 00:00:00 2001 From: Fedor Borshev Date: Sun, 3 Jan 2021 21:23:26 +0300 Subject: [PATCH] Rename courses app to products, pt. 2 (#100) --- src/app/settings.py | 2 +- src/app/urls.py | 2 +- src/courses/admin/__init__.py | 2 -- src/courses/models/__init__.py | 9 --------- src/orders/migrations/0001_initial.py | 6 +++--- src/orders/migrations/0003_OrderBundles.py | 4 ++-- src/orders/migrations/0010_OrderI18n.py | 8 ++++---- src/orders/models/order.py | 6 +++--- src/orders/tests/conftest.py | 6 +++--- src/orders/tests/order_shipping/conftest.py | 2 +- src/orders/tests/promocode/tests_price_with_promocode.py | 2 +- src/orders/tests/test_shipping_unshipped_orders.py | 2 +- src/{courses => products}/__init__.py | 0 src/products/admin/__init__.py | 2 ++ src/{courses => products}/admin/bundle.py | 2 +- src/{courses => products}/admin/course.py | 6 +++--- src/{courses => products}/admin/courses/actions.py | 0 src/{courses => products}/admin/courses/record.py | 2 +- src/{courses => products}/api/serializers.py | 2 +- src/{courses => products}/api/viewsets.py | 4 ++-- src/{courses => products}/apps.py | 0 src/{courses => products}/migrations/0001_initial.py | 4 +++- .../migrations/0002_CourseGenitiveName.py | 2 +- .../migrations/0003_DefaultOrdering.py | 2 +- .../migrations/0004_ReceiptNames.py | 2 +- .../migrations/0005_ClickMeeetingRoomURL.py | 2 +- .../migrations/0006_ShippableFullName.py | 2 +- src/{courses => products}/migrations/0007_L18N.py | 2 +- src/{courses => products}/migrations/0008_Bundles.py | 7 ++++--- .../migrations/0008_CustomTemplateId.py | 2 +- .../migrations/0009_merge_20191222_1525.py | 4 ++-- .../migrations/0010_ParentShippableModel.py | 2 +- src/{courses => products}/migrations/0011_Price.py | 2 +- .../migrations/0012_ZoomusWebinarId.py | 2 +- .../migrations/0013_TemplateIdRename.py | 2 +- .../migrations/0014_CourseWelcomeLetter.py | 2 +- .../migrations/0015_GiftWelcomeLetterTemplateId.py | 2 +- src/{courses => products}/migrations/__init__.py | 0 src/products/models/__init__.py | 9 +++++++++ src/{courses => products}/models/base.py | 0 src/{courses => products}/models/bundle.py | 7 ++++--- src/{courses => products}/models/course.py | 3 ++- src/{courses => products}/models/record.py | 5 +++-- .../static/css/admin/course_action_form.css | 0 .../static/js/admin/course_action_form.js | 0 src/{courses => products}/tasks.py | 2 +- src/{courses => products}/tests/bundles/conftest.py | 6 +++--- .../tests/bundles/tests_bundles_shipping.py | 6 +++--- src/{courses => products}/tests/bundles_api/conftest.py | 2 +- .../tests/bundles_api/tests_bundle_api_read.py | 0 .../tests/bundles_api/tests_purchasing_bundle.py | 0 .../tests_purchasing_bundle_with_promocode.py | 0 src/{courses => products}/tests/conftest.py | 0 src/{courses => products}/tests/course_api/conftest.py | 2 +- .../tests/course_api/tests_course_api_reading.py | 2 +- .../tests/course_api/tests_purchasing_course.py | 0 .../tests/course_api/tests_purchasing_course_as_gift.py | 0 .../course_api/tests_purchasing_course_with_promocode.py | 0 .../tests/courses/tests_course_get_abolute_url.py | 2 +- .../tests/courses/tests_course_get_purchased_users.py | 2 +- .../tests/courses/tests_course_get_template_id.py | 2 +- .../tests/courses/tests_course_get_url.py | 2 +- .../tests_course_send_email_to_all_purchased_users.py | 2 +- src/{courses => products}/tests/price/conftest.py | 2 +- .../tests/price/tests_bundle_api_price_reading.py | 2 +- .../tests/price/tests_course_api_price_reading.py | 2 +- .../tests/price/tests_record_api_price_reading.py | 2 +- src/{courses => products}/tests/record_api/conftest.py | 2 +- .../tests/record_api/tests_purchasing_record.py | 0 .../record_api/tests_purchasing_record_with_promocode.py | 0 .../tests/record_api/tests_record_api_reading.py | 2 +- .../tests/records/tests_record_get_absolute_url.py | 4 ++-- .../tests/records/tests_record_get_template_id.py | 2 +- .../tests/records/tests_record_str.py | 4 ++-- .../tests/shippable/tests_get_price.py | 2 +- src/shipping/shipments/base.py | 2 +- src/shipping/shipments/course.py | 2 +- src/shipping/shipments/record.py | 2 +- src/shipping/test.py | 2 +- src/shipping/tests/course_shipment/conftest.py | 2 +- src/shipping/tests/record_shipment/conftest.py | 4 ++-- src/shipping/tests/shipping_factory/conftest.py | 4 ++-- src/shipping/tests/tests_per_item_template_id.py | 2 +- src/tinkoff/tests/bank_client/conftest.py | 2 +- src/triggers/tests/conftest.py | 6 +++--- .../tests_started_purchase_trigger_template_context.py | 4 ++-- 86 files changed, 113 insertions(+), 107 deletions(-) delete mode 100644 src/courses/admin/__init__.py delete mode 100644 src/courses/models/__init__.py rename src/{courses => products}/__init__.py (100%) create mode 100644 src/products/admin/__init__.py rename src/{courses => products}/admin/bundle.py (95%) rename src/{courses => products}/admin/course.py (88%) rename src/{courses => products}/admin/courses/actions.py (100%) rename src/{courses => products}/admin/courses/record.py (96%) rename src/{courses => products}/api/serializers.py (95%) rename src/{courses => products}/api/viewsets.py (88%) rename src/{courses => products}/apps.py (100%) rename src/{courses => products}/migrations/0001_initial.py (91%) rename src/{courses => products}/migrations/0002_CourseGenitiveName.py (91%) rename src/{courses => products}/migrations/0003_DefaultOrdering.py (89%) rename src/{courses => products}/migrations/0004_ReceiptNames.py (94%) rename src/{courses => products}/migrations/0005_ClickMeeetingRoomURL.py (91%) rename src/{courses => products}/migrations/0006_ShippableFullName.py (97%) rename src/{courses => products}/migrations/0007_L18N.py (91%) rename src/{courses => products}/migrations/0008_Bundles.py (83%) rename src/{courses => products}/migrations/0008_CustomTemplateId.py (95%) rename src/{courses => products}/migrations/0009_merge_20191222_1525.py (67%) rename src/{courses => products}/migrations/0010_ParentShippableModel.py (96%) rename src/{courses => products}/migrations/0011_Price.py (96%) rename src/{courses => products}/migrations/0012_ZoomusWebinarId.py (92%) rename src/{courses => products}/migrations/0013_TemplateIdRename.py (90%) rename src/{courses => products}/migrations/0014_CourseWelcomeLetter.py (92%) rename src/{courses => products}/migrations/0015_GiftWelcomeLetterTemplateId.py (91%) rename src/{courses => products}/migrations/__init__.py (100%) create mode 100644 src/products/models/__init__.py rename src/{courses => products}/models/base.py (100%) rename src/{courses => products}/models/bundle.py (75%) rename src/{courses => products}/models/course.py (95%) rename src/{courses => products}/models/record.py (84%) rename src/{courses => products}/static/css/admin/course_action_form.css (100%) rename src/{courses => products}/static/js/admin/course_action_form.js (100%) rename src/{courses => products}/tasks.py (74%) rename src/{courses => products}/tests/bundles/conftest.py (56%) rename src/{courses => products}/tests/bundles/tests_bundles_shipping.py (85%) rename src/{courses => products}/tests/bundles_api/conftest.py (81%) rename src/{courses => products}/tests/bundles_api/tests_bundle_api_read.py (100%) rename src/{courses => products}/tests/bundles_api/tests_purchasing_bundle.py (100%) rename src/{courses => products}/tests/bundles_api/tests_purchasing_bundle_with_promocode.py (100%) rename src/{courses => products}/tests/conftest.py (100%) rename src/{courses => products}/tests/course_api/conftest.py (87%) rename src/{courses => products}/tests/course_api/tests_course_api_reading.py (92%) rename src/{courses => products}/tests/course_api/tests_purchasing_course.py (100%) rename src/{courses => products}/tests/course_api/tests_purchasing_course_as_gift.py (100%) rename src/{courses => products}/tests/course_api/tests_purchasing_course_with_promocode.py (100%) rename src/{courses => products}/tests/courses/tests_course_get_abolute_url.py (81%) rename src/{courses => products}/tests/courses/tests_course_get_purchased_users.py (96%) rename src/{courses => products}/tests/courses/tests_course_get_template_id.py (88%) rename src/{courses => products}/tests/courses/tests_course_get_url.py (86%) rename src/{courses => products}/tests/courses/tests_course_send_email_to_all_purchased_users.py (94%) rename src/{courses => products}/tests/price/conftest.py (50%) rename src/{courses => products}/tests/price/tests_bundle_api_price_reading.py (78%) rename src/{courses => products}/tests/price/tests_course_api_price_reading.py (87%) rename src/{courses => products}/tests/price/tests_record_api_price_reading.py (87%) rename src/{courses => products}/tests/record_api/conftest.py (87%) rename src/{courses => products}/tests/record_api/tests_purchasing_record.py (100%) rename src/{courses => products}/tests/record_api/tests_purchasing_record_with_promocode.py (100%) rename src/{courses => products}/tests/record_api/tests_record_api_reading.py (92%) rename src/{courses => products}/tests/records/tests_record_get_absolute_url.py (72%) rename src/{courses => products}/tests/records/tests_record_get_template_id.py (88%) rename src/{courses => products}/tests/records/tests_record_str.py (56%) rename src/{courses => products}/tests/shippable/tests_get_price.py (85%) diff --git a/src/app/settings.py b/src/app/settings.py index fe6d8b915ea..87f5789e4d9 100644 --- a/src/app/settings.py +++ b/src/app/settings.py @@ -64,7 +64,7 @@ 'app', 'users', 'orders', - 'courses', + 'products', 'shipping', 'tinkoff', 'triggers', diff --git a/src/app/urls.py b/src/app/urls.py index 0846fe14e16..ba3d37537b7 100644 --- a/src/app/urls.py +++ b/src/app/urls.py @@ -7,8 +7,8 @@ from urllib.parse import urljoin from app.views import HomePageView -from courses.api.viewsets import BundleViewSet, CourseViewSet, RecordViewSet from magnets.api.views import EmailLeadMagnetCampaignView +from products.api.viewsets import BundleViewSet, CourseViewSet, RecordViewSet from tinkoff.api.views import TinkoffPaymentNotificationsView from users.api.views import UserView diff --git a/src/courses/admin/__init__.py b/src/courses/admin/__init__.py deleted file mode 100644 index 8d7fd7a5f23..00000000000 --- a/src/courses/admin/__init__.py +++ /dev/null @@ -1,2 +0,0 @@ -import courses.admin.bundle # noqa -import courses.admin.course # noqa diff --git a/src/courses/models/__init__.py b/src/courses/models/__init__.py deleted file mode 100644 index 3553b3d2ffb..00000000000 --- a/src/courses/models/__init__.py +++ /dev/null @@ -1,9 +0,0 @@ -from courses.models.bundle import Bundle -from courses.models.course import Course -from courses.models.record import Record - -__all__ = [ - Bundle, - Course, - Record, -] diff --git a/src/orders/migrations/0001_initial.py b/src/orders/migrations/0001_initial.py index bc94d0e88c3..7cee0cd3bbb 100644 --- a/src/orders/migrations/0001_initial.py +++ b/src/orders/migrations/0001_initial.py @@ -13,7 +13,7 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('courses', '0002_CourseGenitiveName'), + ('products', '0002_CourseGenitiveName'), migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] @@ -27,8 +27,8 @@ class Migration(migrations.Migration): ('price', models.DecimalField(decimal_places=2, max_digits=9)), ('paid', models.DateTimeField('Date when order got paid', null=True, blank=True, help_text='If set during creation, order automaticaly gets shipped')), ('shipped', models.DateTimeField('Date when order was shipped', null=True, blank=True)), - ('course', orders.fields.ItemField(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='courses.Course')), - ('record', orders.fields.ItemField(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='courses.Record')), + ('course', orders.fields.ItemField(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='products.Course')), + ('record', orders.fields.ItemField(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='products.Record')), ('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)), ], options={ diff --git a/src/orders/migrations/0003_OrderBundles.py b/src/orders/migrations/0003_OrderBundles.py index cae346293f3..349deba68d8 100644 --- a/src/orders/migrations/0003_OrderBundles.py +++ b/src/orders/migrations/0003_OrderBundles.py @@ -10,7 +10,7 @@ class Migration(migrations.Migration): dependencies = [ - ('courses', '0008_Bundles'), + ('products', '0008_Bundles'), ('orders', '0002_L18N'), ] @@ -18,6 +18,6 @@ class Migration(migrations.Migration): migrations.AddField( model_name='order', name='bundle', - field=orders.fields.ItemField(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='courses.Bundle'), + field=orders.fields.ItemField(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='products.Bundle'), ), ] diff --git a/src/orders/migrations/0010_OrderI18n.py b/src/orders/migrations/0010_OrderI18n.py index 2b6859cff08..c9374151c64 100644 --- a/src/orders/migrations/0010_OrderI18n.py +++ b/src/orders/migrations/0010_OrderI18n.py @@ -11,7 +11,7 @@ class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ('courses', '0014_CourseWelcomeLetter'), + ('products', '0014_CourseWelcomeLetter'), ('orders', '0009_Gifts'), ] @@ -19,12 +19,12 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='order', name='bundle', - field=orders.fields.ItemField(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='courses.bundle', verbose_name='Bundle'), + field=orders.fields.ItemField(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='products.bundle', verbose_name='Bundle'), ), migrations.AlterField( model_name='order', name='course', - field=orders.fields.ItemField(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='courses.course', verbose_name='Course'), + field=orders.fields.ItemField(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='products.course', verbose_name='Course'), ), migrations.AlterField( model_name='order', @@ -44,7 +44,7 @@ class Migration(migrations.Migration): migrations.AlterField( model_name='order', name='record', - field=orders.fields.ItemField(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='courses.record', verbose_name='Record'), + field=orders.fields.ItemField(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='products.record', verbose_name='Record'), ), migrations.AlterField( model_name='order', diff --git a/src/orders/models/order.py b/src/orders/models/order.py index 3bdee518d24..4fef9430c53 100644 --- a/src/orders/models/order.py +++ b/src/orders/models/order.py @@ -34,9 +34,9 @@ class Order(TimestampedModel): ) shipped = models.DateTimeField(_('Date when order was shipped'), null=True, blank=True) - course = ItemField(to='courses.Course', verbose_name=_('Course'), null=True, blank=True, on_delete=models.PROTECT) - record = ItemField(to='courses.Record', verbose_name=_('Record'), null=True, blank=True, on_delete=models.PROTECT) - bundle = ItemField(to='courses.Bundle', verbose_name=_('Bundle'), null=True, blank=True, on_delete=models.PROTECT) + course = ItemField(to='products.Course', verbose_name=_('Course'), null=True, blank=True, on_delete=models.PROTECT) + record = ItemField(to='products.Record', verbose_name=_('Record'), null=True, blank=True, on_delete=models.PROTECT) + bundle = ItemField(to='products.Bundle', verbose_name=_('Bundle'), null=True, blank=True, on_delete=models.PROTECT) giver = models.ForeignKey('users.User', verbose_name=_('Giver'), null=True, blank=True, on_delete=models.SET_NULL, related_name='created_gifts') desired_shipment_date = models.DateTimeField(_('Date when the gift should be shipped'), null=True, blank=True) diff --git a/src/orders/tests/conftest.py b/src/orders/tests/conftest.py index 3235a9b6645..7e9a9b840f5 100644 --- a/src/orders/tests/conftest.py +++ b/src/orders/tests/conftest.py @@ -5,14 +5,14 @@ @pytest.fixture def course(mixer): - return mixer.blend('courses.Course', name='Кройка и шитьё', name_genitive='Кройки и шитья', price=100500) + return mixer.blend('products.Course', name='Кройка и шитьё', name_genitive='Кройки и шитья', price=100500) @pytest.fixture def record(mixer, course): - return mixer.blend('courses.Record', course=course, price=100500) + return mixer.blend('products.Record', course=course, price=100500) @pytest.fixture def bundle(mixer): - return mixer.blend('courses.Bundle') + return mixer.blend('products.Bundle') diff --git a/src/orders/tests/order_shipping/conftest.py b/src/orders/tests/order_shipping/conftest.py index c4065824d12..f42a20b5419 100644 --- a/src/orders/tests/order_shipping/conftest.py +++ b/src/orders/tests/order_shipping/conftest.py @@ -15,7 +15,7 @@ def ship(mocker): @pytest.fixture def record(mixer): - return mixer.blend('courses.Record', course__name_genitive='курсов катанья и мытья', full_name='Полная запись курса катанья и мытья') + return mixer.blend('products.Record', course__name_genitive='курсов катанья и мытья', full_name='Полная запись курса катанья и мытья') @pytest.fixture diff --git a/src/orders/tests/promocode/tests_price_with_promocode.py b/src/orders/tests/promocode/tests_price_with_promocode.py index 2729f29f982..77d9d7a06c1 100644 --- a/src/orders/tests/promocode/tests_price_with_promocode.py +++ b/src/orders/tests/promocode/tests_price_with_promocode.py @@ -5,7 +5,7 @@ @pytest.fixture def course(mixer): - return mixer.blend('courses.Course', price=100500) + return mixer.blend('products.Course', price=100500) @pytest.fixture(autouse=True) diff --git a/src/orders/tests/test_shipping_unshipped_orders.py b/src/orders/tests/test_shipping_unshipped_orders.py index c179b9139f2..e2f2c504193 100644 --- a/src/orders/tests/test_shipping_unshipped_orders.py +++ b/src/orders/tests/test_shipping_unshipped_orders.py @@ -11,7 +11,7 @@ @pytest.fixture def product(mixer): - return mixer.blend('courses.Record') + return mixer.blend('products.Record') @pytest.fixture diff --git a/src/courses/__init__.py b/src/products/__init__.py similarity index 100% rename from src/courses/__init__.py rename to src/products/__init__.py diff --git a/src/products/admin/__init__.py b/src/products/admin/__init__.py new file mode 100644 index 00000000000..7262a51eaa7 --- /dev/null +++ b/src/products/admin/__init__.py @@ -0,0 +1,2 @@ +import products.admin.bundle # noqa +import products.admin.course # noqa diff --git a/src/courses/admin/bundle.py b/src/products/admin/bundle.py similarity index 95% rename from src/courses/admin/bundle.py rename to src/products/admin/bundle.py index 82b977393ae..15ff619ff66 100644 --- a/src/courses/admin/bundle.py +++ b/src/products/admin/bundle.py @@ -1,7 +1,7 @@ from django.utils.translation import gettext_lazy as _ from app.admin import ModelAdmin, admin -from courses.models import Bundle +from products.models import Bundle @admin.register(Bundle) diff --git a/src/courses/admin/course.py b/src/products/admin/course.py similarity index 88% rename from src/courses/admin/course.py rename to src/products/admin/course.py index 76b5d8b16bd..e27b805b382 100644 --- a/src/courses/admin/course.py +++ b/src/products/admin/course.py @@ -1,9 +1,9 @@ from django.utils.translation import gettext_lazy as _ from app.admin import ModelAdmin, admin -from courses.admin.courses import actions -from courses.admin.courses.record import RecordAdmin -from courses.models import Course +from products.admin.courses import actions +from products.admin.courses.record import RecordAdmin +from products.models import Course @admin.register(Course) diff --git a/src/courses/admin/courses/actions.py b/src/products/admin/courses/actions.py similarity index 100% rename from src/courses/admin/courses/actions.py rename to src/products/admin/courses/actions.py diff --git a/src/courses/admin/courses/record.py b/src/products/admin/courses/record.py similarity index 96% rename from src/courses/admin/courses/record.py rename to src/products/admin/courses/record.py index 4594a987330..bae752e2e08 100644 --- a/src/courses/admin/courses/record.py +++ b/src/products/admin/courses/record.py @@ -2,7 +2,7 @@ from django.utils.translation import gettext_lazy as _ from app.admin import StackedInline -from courses.models import Record +from products.models import Record class RecordAdmin(StackedInline): diff --git a/src/courses/api/serializers.py b/src/products/api/serializers.py similarity index 95% rename from src/courses/api/serializers.py rename to src/products/api/serializers.py index 1f12c7fc831..28dd56ffe6a 100644 --- a/src/courses/api/serializers.py +++ b/src/products/api/serializers.py @@ -1,6 +1,6 @@ from rest_framework import serializers -from courses.models import Bundle, Course, Record +from products.models import Bundle, Course, Record class ShippableSerializer(serializers.ModelSerializer): diff --git a/src/courses/api/viewsets.py b/src/products/api/viewsets.py similarity index 88% rename from src/courses/api/viewsets.py rename to src/products/api/viewsets.py index 99ea0594ecb..ddd14a85598 100644 --- a/src/courses/api/viewsets.py +++ b/src/products/api/viewsets.py @@ -1,8 +1,8 @@ from app.permissions import AllowAny -from courses.api import serializers -from courses.models import Bundle, Course, Record from orders.api.base import PurchaseViewSet +from products.api import serializers +from products.models import Bundle, Course, Record class RecordViewSet(PurchaseViewSet): diff --git a/src/courses/apps.py b/src/products/apps.py similarity index 100% rename from src/courses/apps.py rename to src/products/apps.py diff --git a/src/courses/migrations/0001_initial.py b/src/products/migrations/0001_initial.py similarity index 91% rename from src/courses/migrations/0001_initial.py rename to src/products/migrations/0001_initial.py index e9e6a564c17..11a9e5937ca 100644 --- a/src/courses/migrations/0001_initial.py +++ b/src/products/migrations/0001_initial.py @@ -23,6 +23,7 @@ class Migration(migrations.Migration): ], options={ 'abstract': False, + 'db_table': 'courses_course', }, ), migrations.CreateModel( @@ -34,10 +35,11 @@ class Migration(migrations.Migration): ('name', models.CharField(max_length=255)), ('slug', models.SlugField()), ('s3_object_id', models.CharField(max_length=512)), - ('course', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='courses.Course')), + ('course', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='products.Course')), ], options={ 'abstract': False, + 'db_table': 'courses_record', }, ), ] diff --git a/src/courses/migrations/0002_CourseGenitiveName.py b/src/products/migrations/0002_CourseGenitiveName.py similarity index 91% rename from src/courses/migrations/0002_CourseGenitiveName.py rename to src/products/migrations/0002_CourseGenitiveName.py index d196440418c..fa15246835a 100644 --- a/src/courses/migrations/0002_CourseGenitiveName.py +++ b/src/products/migrations/0002_CourseGenitiveName.py @@ -6,7 +6,7 @@ class Migration(migrations.Migration): dependencies = [ - ('courses', '0001_initial'), + ('products', '0001_initial'), ] operations = [ diff --git a/src/courses/migrations/0003_DefaultOrdering.py b/src/products/migrations/0003_DefaultOrdering.py similarity index 89% rename from src/courses/migrations/0003_DefaultOrdering.py rename to src/products/migrations/0003_DefaultOrdering.py index 02d11c9dbfd..79de361e68e 100644 --- a/src/courses/migrations/0003_DefaultOrdering.py +++ b/src/products/migrations/0003_DefaultOrdering.py @@ -6,7 +6,7 @@ class Migration(migrations.Migration): dependencies = [ - ('courses', '0002_CourseGenitiveName'), + ('products', '0002_CourseGenitiveName'), ] operations = [ diff --git a/src/courses/migrations/0004_ReceiptNames.py b/src/products/migrations/0004_ReceiptNames.py similarity index 94% rename from src/courses/migrations/0004_ReceiptNames.py rename to src/products/migrations/0004_ReceiptNames.py index 2d36658032f..7bfe1e6314d 100644 --- a/src/courses/migrations/0004_ReceiptNames.py +++ b/src/products/migrations/0004_ReceiptNames.py @@ -6,7 +6,7 @@ class Migration(migrations.Migration): dependencies = [ - ('courses', '0003_DefaultOrdering'), + ('products', '0003_DefaultOrdering'), ] operations = [ diff --git a/src/courses/migrations/0005_ClickMeeetingRoomURL.py b/src/products/migrations/0005_ClickMeeetingRoomURL.py similarity index 91% rename from src/courses/migrations/0005_ClickMeeetingRoomURL.py rename to src/products/migrations/0005_ClickMeeetingRoomURL.py index 246b338a93d..36e08422a93 100644 --- a/src/courses/migrations/0005_ClickMeeetingRoomURL.py +++ b/src/products/migrations/0005_ClickMeeetingRoomURL.py @@ -6,7 +6,7 @@ class Migration(migrations.Migration): dependencies = [ - ('courses', '0004_ReceiptNames'), + ('products', '0004_ReceiptNames'), ] operations = [ diff --git a/src/courses/migrations/0006_ShippableFullName.py b/src/products/migrations/0006_ShippableFullName.py similarity index 97% rename from src/courses/migrations/0006_ShippableFullName.py rename to src/products/migrations/0006_ShippableFullName.py index 77f8c41d079..d8f1098b74f 100644 --- a/src/courses/migrations/0006_ShippableFullName.py +++ b/src/products/migrations/0006_ShippableFullName.py @@ -6,7 +6,7 @@ class Migration(migrations.Migration): dependencies = [ - ('courses', '0005_ClickMeeetingRoomURL'), + ('products', '0005_ClickMeeetingRoomURL'), ] operations = [ diff --git a/src/courses/migrations/0007_L18N.py b/src/products/migrations/0007_L18N.py similarity index 91% rename from src/courses/migrations/0007_L18N.py rename to src/products/migrations/0007_L18N.py index 62fc847871f..833935cd7ff 100644 --- a/src/courses/migrations/0007_L18N.py +++ b/src/products/migrations/0007_L18N.py @@ -6,7 +6,7 @@ class Migration(migrations.Migration): dependencies = [ - ('courses', '0006_ShippableFullName'), + ('products', '0006_ShippableFullName'), ] operations = [ diff --git a/src/courses/migrations/0008_Bundles.py b/src/products/migrations/0008_Bundles.py similarity index 83% rename from src/courses/migrations/0008_Bundles.py rename to src/products/migrations/0008_Bundles.py index 20161e50121..2dfead37698 100644 --- a/src/courses/migrations/0008_Bundles.py +++ b/src/products/migrations/0008_Bundles.py @@ -6,7 +6,7 @@ class Migration(migrations.Migration): dependencies = [ - ('courses', '0007_L18N'), + ('products', '0007_L18N'), ] operations = [ @@ -20,13 +20,14 @@ class Migration(migrations.Migration): ('name_receipt', models.CharField(help_text='«Доступ к записи курсов кройки и шитья»', max_length=255, verbose_name='Name for receipts')), ('slug', models.SlugField()), ('full_name', models.CharField(help_text='«Запись мастер-класса о TDD»', max_length=255, verbose_name='Full name for letters')), - ('courses', models.ManyToManyField(to='courses.Course')), - ('records', models.ManyToManyField(to='courses.Record')), + ('courses', models.ManyToManyField(to='products.Course')), + ('records', models.ManyToManyField(to='products.Record')), ], options={ 'verbose_name': 'Bundle', 'verbose_name_plural': 'Bundles', 'ordering': ['-id'], + 'db_table': 'courses_bundle', }, ), ] diff --git a/src/courses/migrations/0008_CustomTemplateId.py b/src/products/migrations/0008_CustomTemplateId.py similarity index 95% rename from src/courses/migrations/0008_CustomTemplateId.py rename to src/products/migrations/0008_CustomTemplateId.py index bd4b3438bd2..319a9b6e5cc 100644 --- a/src/courses/migrations/0008_CustomTemplateId.py +++ b/src/products/migrations/0008_CustomTemplateId.py @@ -6,7 +6,7 @@ class Migration(migrations.Migration): dependencies = [ - ('courses', '0007_L18N'), + ('products', '0007_L18N'), ] operations = [ diff --git a/src/courses/migrations/0009_merge_20191222_1525.py b/src/products/migrations/0009_merge_20191222_1525.py similarity index 67% rename from src/courses/migrations/0009_merge_20191222_1525.py rename to src/products/migrations/0009_merge_20191222_1525.py index eb0c23844a2..7b4c265ee7f 100644 --- a/src/courses/migrations/0009_merge_20191222_1525.py +++ b/src/products/migrations/0009_merge_20191222_1525.py @@ -6,8 +6,8 @@ class Migration(migrations.Migration): dependencies = [ - ('courses', '0008_Bundles'), - ('courses', '0008_CustomTemplateId'), + ('products', '0008_Bundles'), + ('products', '0008_CustomTemplateId'), ] operations = [ diff --git a/src/courses/migrations/0010_ParentShippableModel.py b/src/products/migrations/0010_ParentShippableModel.py similarity index 96% rename from src/courses/migrations/0010_ParentShippableModel.py rename to src/products/migrations/0010_ParentShippableModel.py index 7db66e009f0..4fd2b05f685 100644 --- a/src/courses/migrations/0010_ParentShippableModel.py +++ b/src/products/migrations/0010_ParentShippableModel.py @@ -6,7 +6,7 @@ class Migration(migrations.Migration): dependencies = [ - ('courses', '0009_merge_20191222_1525'), + ('products', '0009_merge_20191222_1525'), ] operations = [ diff --git a/src/courses/migrations/0011_Price.py b/src/products/migrations/0011_Price.py similarity index 96% rename from src/courses/migrations/0011_Price.py rename to src/products/migrations/0011_Price.py index b2becdd9c92..8e14035d7fd 100644 --- a/src/courses/migrations/0011_Price.py +++ b/src/products/migrations/0011_Price.py @@ -6,7 +6,7 @@ class Migration(migrations.Migration): dependencies = [ - ('courses', '0010_ParentShippableModel'), + ('products', '0010_ParentShippableModel'), ] operations = [ diff --git a/src/courses/migrations/0012_ZoomusWebinarId.py b/src/products/migrations/0012_ZoomusWebinarId.py similarity index 92% rename from src/courses/migrations/0012_ZoomusWebinarId.py rename to src/products/migrations/0012_ZoomusWebinarId.py index 363c61f1c1f..14de5532043 100644 --- a/src/courses/migrations/0012_ZoomusWebinarId.py +++ b/src/products/migrations/0012_ZoomusWebinarId.py @@ -6,7 +6,7 @@ class Migration(migrations.Migration): dependencies = [ - ('courses', '0011_Price'), + ('products', '0011_Price'), ] operations = [ diff --git a/src/courses/migrations/0013_TemplateIdRename.py b/src/products/migrations/0013_TemplateIdRename.py similarity index 90% rename from src/courses/migrations/0013_TemplateIdRename.py rename to src/products/migrations/0013_TemplateIdRename.py index 8249c432cc6..55b891e6e40 100644 --- a/src/courses/migrations/0013_TemplateIdRename.py +++ b/src/products/migrations/0013_TemplateIdRename.py @@ -6,7 +6,7 @@ class Migration(migrations.Migration): dependencies = [ - ('courses', '0012_ZoomusWebinarId'), + ('products', '0012_ZoomusWebinarId'), ] operations = [ diff --git a/src/courses/migrations/0014_CourseWelcomeLetter.py b/src/products/migrations/0014_CourseWelcomeLetter.py similarity index 92% rename from src/courses/migrations/0014_CourseWelcomeLetter.py rename to src/products/migrations/0014_CourseWelcomeLetter.py index a0f5bc2fcb9..ac89965fc75 100644 --- a/src/courses/migrations/0014_CourseWelcomeLetter.py +++ b/src/products/migrations/0014_CourseWelcomeLetter.py @@ -6,7 +6,7 @@ class Migration(migrations.Migration): dependencies = [ - ('courses', '0013_TemplateIdRename'), + ('products', '0013_TemplateIdRename'), ] operations = [ diff --git a/src/courses/migrations/0015_GiftWelcomeLetterTemplateId.py b/src/products/migrations/0015_GiftWelcomeLetterTemplateId.py similarity index 91% rename from src/courses/migrations/0015_GiftWelcomeLetterTemplateId.py rename to src/products/migrations/0015_GiftWelcomeLetterTemplateId.py index b72a44abea0..e651fcfec09 100644 --- a/src/courses/migrations/0015_GiftWelcomeLetterTemplateId.py +++ b/src/products/migrations/0015_GiftWelcomeLetterTemplateId.py @@ -6,7 +6,7 @@ class Migration(migrations.Migration): dependencies = [ - ('courses', '0014_CourseWelcomeLetter'), + ('products', '0014_CourseWelcomeLetter'), ] operations = [ diff --git a/src/courses/migrations/__init__.py b/src/products/migrations/__init__.py similarity index 100% rename from src/courses/migrations/__init__.py rename to src/products/migrations/__init__.py diff --git a/src/products/models/__init__.py b/src/products/models/__init__.py new file mode 100644 index 00000000000..4d678074035 --- /dev/null +++ b/src/products/models/__init__.py @@ -0,0 +1,9 @@ +from products.models.bundle import Bundle +from products.models.course import Course +from products.models.record import Record + +__all__ = [ + Bundle, + Course, + Record, +] diff --git a/src/courses/models/base.py b/src/products/models/base.py similarity index 100% rename from src/courses/models/base.py rename to src/products/models/base.py diff --git a/src/courses/models/bundle.py b/src/products/models/bundle.py similarity index 75% rename from src/courses/models/bundle.py rename to src/products/models/bundle.py index 2b8204a0bac..1ad2c1f0e63 100644 --- a/src/courses/models/bundle.py +++ b/src/products/models/bundle.py @@ -3,17 +3,18 @@ from urllib.parse import urljoin from app.models import models -from courses.models.base import Shippable +from products.models.base import Shippable class Bundle(Shippable): - records = models.ManyToManyField('courses.Record') - courses = models.ManyToManyField('courses.Course') + records = models.ManyToManyField('products.Record') + courses = models.ManyToManyField('products.Course') class Meta: ordering = ['-id'] verbose_name = _('Bundle') verbose_name_plural = _('Bundles') + db_table = 'courses_bundle' def get_absolute_url(self): return urljoin(settings.FRONTEND_URL, '/'.join(['bundles', self.slug, ''])) diff --git a/src/courses/models/course.py b/src/products/models/course.py similarity index 95% rename from src/courses/models/course.py rename to src/products/models/course.py index 67937c048a2..9f933043d93 100644 --- a/src/courses/models/course.py +++ b/src/products/models/course.py @@ -7,7 +7,7 @@ from app.models import models from app.tasks import send_mail -from courses.models.base import Shippable +from products.models.base import Shippable from users.models import User @@ -23,6 +23,7 @@ class Meta: ordering = ['-id'] verbose_name = _('Course') verbose_name_plural = _('Courses') + db_table = 'courses_course' def get_absolute_url(self) -> str: return urljoin(settings.FRONTEND_URL, '/'.join(['courses', self.slug, ''])) diff --git a/src/courses/models/record.py b/src/products/models/record.py similarity index 84% rename from src/courses/models/record.py rename to src/products/models/record.py index 879f3a2113a..4845743af6d 100644 --- a/src/courses/models/record.py +++ b/src/products/models/record.py @@ -2,11 +2,11 @@ from app.integrations.s3 import AppS3 from app.models import models -from courses.models.base import Shippable +from products.models.base import Shippable class Record(Shippable): - course = models.ForeignKey('courses.Course', on_delete=models.CASCADE) + course = models.ForeignKey('products.Course', on_delete=models.CASCADE) s3_object_id = models.CharField(max_length=512) template_id = models.CharField(_('Postmark template_id'), max_length=256, blank=True, null=True, help_text=_('Leave it blank for the default template')) @@ -15,6 +15,7 @@ class Meta: ordering = ['-id'] verbose_name = _('Record') verbose_name_plural = _('Records') + db_table = 'courses_record' @property def name_genitive(self): diff --git a/src/courses/static/css/admin/course_action_form.css b/src/products/static/css/admin/course_action_form.css similarity index 100% rename from src/courses/static/css/admin/course_action_form.css rename to src/products/static/css/admin/course_action_form.css diff --git a/src/courses/static/js/admin/course_action_form.js b/src/products/static/js/admin/course_action_form.js similarity index 100% rename from src/courses/static/js/admin/course_action_form.js rename to src/products/static/js/admin/course_action_form.js diff --git a/src/courses/tasks.py b/src/products/tasks.py similarity index 74% rename from src/courses/tasks.py rename to src/products/tasks.py index 15a64f7c1b2..037f3cbb84a 100644 --- a/src/courses/tasks.py +++ b/src/products/tasks.py @@ -5,7 +5,7 @@ @celery.task def test_task(): - apps.get_model('courses.Course').objects.create( + apps.get_model('products.Course').objects.create( name='test_deffered', slug='sluuggsdftest', ) diff --git a/src/courses/tests/bundles/conftest.py b/src/products/tests/bundles/conftest.py similarity index 56% rename from src/courses/tests/bundles/conftest.py rename to src/products/tests/bundles/conftest.py index 0f59156f65c..3999d8bf32d 100644 --- a/src/courses/tests/bundles/conftest.py +++ b/src/products/tests/bundles/conftest.py @@ -5,14 +5,14 @@ @pytest.fixture def course(mixer): - return mixer.blend('courses.Course') + return mixer.blend('products.Course') @pytest.fixture def record(mixer): - return mixer.blend('courses.Record') + return mixer.blend('products.Record') @pytest.fixture def bundle(mixer): - return mixer.blend('courses.Bundle') + return mixer.blend('products.Bundle') diff --git a/src/courses/tests/bundles/tests_bundles_shipping.py b/src/products/tests/bundles/tests_bundles_shipping.py similarity index 85% rename from src/courses/tests/bundles/tests_bundles_shipping.py rename to src/products/tests/bundles/tests_bundles_shipping.py index 268082fc38b..5ad035afcf9 100644 --- a/src/courses/tests/bundles/tests_bundles_shipping.py +++ b/src/products/tests/bundles/tests_bundles_shipping.py @@ -5,17 +5,17 @@ @pytest.fixture def ship_course(mocker): - return mocker.patch('courses.models.Course.ship') + return mocker.patch('products.models.Course.ship') @pytest.fixture def ship_record(mocker): - return mocker.patch('courses.models.Record.ship') + return mocker.patch('products.models.Record.ship') @pytest.fixture def another_record(mixer): - return mixer.blend('courses.Record') + return mixer.blend('products.Record') def test_shipping_course(bundle, user, course, ship_course): diff --git a/src/courses/tests/bundles_api/conftest.py b/src/products/tests/bundles_api/conftest.py similarity index 81% rename from src/courses/tests/bundles_api/conftest.py rename to src/products/tests/bundles_api/conftest.py index 9d3e99e7d51..038003d8ed1 100644 --- a/src/courses/tests/bundles_api/conftest.py +++ b/src/products/tests/bundles_api/conftest.py @@ -7,7 +7,7 @@ @pytest.fixture def bundle(mixer): - return mixer.blend('courses.Bundle', slug='pinetree-tickets', name='Флаг и билет на ёлку', price=1900) + return mixer.blend('products.Bundle', slug='pinetree-tickets', name='Флаг и билет на ёлку', price=1900) @pytest.fixture(autouse=True) diff --git a/src/courses/tests/bundles_api/tests_bundle_api_read.py b/src/products/tests/bundles_api/tests_bundle_api_read.py similarity index 100% rename from src/courses/tests/bundles_api/tests_bundle_api_read.py rename to src/products/tests/bundles_api/tests_bundle_api_read.py diff --git a/src/courses/tests/bundles_api/tests_purchasing_bundle.py b/src/products/tests/bundles_api/tests_purchasing_bundle.py similarity index 100% rename from src/courses/tests/bundles_api/tests_purchasing_bundle.py rename to src/products/tests/bundles_api/tests_purchasing_bundle.py diff --git a/src/courses/tests/bundles_api/tests_purchasing_bundle_with_promocode.py b/src/products/tests/bundles_api/tests_purchasing_bundle_with_promocode.py similarity index 100% rename from src/courses/tests/bundles_api/tests_purchasing_bundle_with_promocode.py rename to src/products/tests/bundles_api/tests_purchasing_bundle_with_promocode.py diff --git a/src/courses/tests/conftest.py b/src/products/tests/conftest.py similarity index 100% rename from src/courses/tests/conftest.py rename to src/products/tests/conftest.py diff --git a/src/courses/tests/course_api/conftest.py b/src/products/tests/course_api/conftest.py similarity index 87% rename from src/courses/tests/course_api/conftest.py rename to src/products/tests/course_api/conftest.py index 367f2474165..f390f19aa16 100644 --- a/src/courses/tests/course_api/conftest.py +++ b/src/products/tests/course_api/conftest.py @@ -7,7 +7,7 @@ @pytest.fixture(autouse=True) def course(mixer): - return mixer.blend('courses.Course', slug='ruloning-oboev', price=1900) + return mixer.blend('products.Course', slug='ruloning-oboev', price=1900) @pytest.fixture(autouse=True) diff --git a/src/courses/tests/course_api/tests_course_api_reading.py b/src/products/tests/course_api/tests_course_api_reading.py similarity index 92% rename from src/courses/tests/course_api/tests_course_api_reading.py rename to src/products/tests/course_api/tests_course_api_reading.py index 49b481f2a25..15f73ced118 100644 --- a/src/courses/tests/course_api/tests_course_api_reading.py +++ b/src/products/tests/course_api/tests_course_api_reading.py @@ -5,7 +5,7 @@ @pytest.fixture def course(mixer): - return mixer.blend('courses.Course') + return mixer.blend('products.Course') @pytest.mark.parametrize('field', [ diff --git a/src/courses/tests/course_api/tests_purchasing_course.py b/src/products/tests/course_api/tests_purchasing_course.py similarity index 100% rename from src/courses/tests/course_api/tests_purchasing_course.py rename to src/products/tests/course_api/tests_purchasing_course.py diff --git a/src/courses/tests/course_api/tests_purchasing_course_as_gift.py b/src/products/tests/course_api/tests_purchasing_course_as_gift.py similarity index 100% rename from src/courses/tests/course_api/tests_purchasing_course_as_gift.py rename to src/products/tests/course_api/tests_purchasing_course_as_gift.py diff --git a/src/courses/tests/course_api/tests_purchasing_course_with_promocode.py b/src/products/tests/course_api/tests_purchasing_course_with_promocode.py similarity index 100% rename from src/courses/tests/course_api/tests_purchasing_course_with_promocode.py rename to src/products/tests/course_api/tests_purchasing_course_with_promocode.py diff --git a/src/courses/tests/courses/tests_course_get_abolute_url.py b/src/products/tests/courses/tests_course_get_abolute_url.py similarity index 81% rename from src/courses/tests/courses/tests_course_get_abolute_url.py rename to src/products/tests/courses/tests_course_get_abolute_url.py index 74c6e5efdbd..0303b627059 100644 --- a/src/courses/tests/courses/tests_course_get_abolute_url.py +++ b/src/products/tests/courses/tests_course_get_abolute_url.py @@ -9,6 +9,6 @@ def set_main_website(settings): def test(mixer): - course = mixer.blend('courses.Course', slug='tst-slug') + course = mixer.blend('products.Course', slug='tst-slug') assert course.get_absolute_url() == 'https://test.mocked/courses/tst-slug/' diff --git a/src/courses/tests/courses/tests_course_get_purchased_users.py b/src/products/tests/courses/tests_course_get_purchased_users.py similarity index 96% rename from src/courses/tests/courses/tests_course_get_purchased_users.py rename to src/products/tests/courses/tests_course_get_purchased_users.py index 961ab474330..daa80a27276 100644 --- a/src/courses/tests/courses/tests_course_get_purchased_users.py +++ b/src/products/tests/courses/tests_course_get_purchased_users.py @@ -6,7 +6,7 @@ @pytest.fixture def course(mixer): - return mixer.blend('courses.Course') + return mixer.blend('products.Course') @pytest.fixture diff --git a/src/courses/tests/courses/tests_course_get_template_id.py b/src/products/tests/courses/tests_course_get_template_id.py similarity index 88% rename from src/courses/tests/courses/tests_course_get_template_id.py rename to src/products/tests/courses/tests_course_get_template_id.py index 5a0221c6f76..5d40c4511d0 100644 --- a/src/courses/tests/courses/tests_course_get_template_id.py +++ b/src/products/tests/courses/tests_course_get_template_id.py @@ -5,7 +5,7 @@ @pytest.fixture def course(mixer): - return mixer.blend('courses.Course') + return mixer.blend('products.Course') @pytest.mark.parametrize('template_id, expected', [ diff --git a/src/courses/tests/courses/tests_course_get_url.py b/src/products/tests/courses/tests_course_get_url.py similarity index 86% rename from src/courses/tests/courses/tests_course_get_url.py rename to src/products/tests/courses/tests_course_get_url.py index 05533ffe3e7..16d363c2a2c 100644 --- a/src/courses/tests/courses/tests_course_get_url.py +++ b/src/products/tests/courses/tests_course_get_url.py @@ -10,7 +10,7 @@ def get_url(mocker): @pytest.fixture def record(mixer): - return mixer.blend('courses.Record', s3_object_id='homevideo-2032-12-01.mp4') + return mixer.blend('products.Record', s3_object_id='homevideo-2032-12-01.mp4') def test_works(record): diff --git a/src/courses/tests/courses/tests_course_send_email_to_all_purchased_users.py b/src/products/tests/courses/tests_course_send_email_to_all_purchased_users.py similarity index 94% rename from src/courses/tests/courses/tests_course_send_email_to_all_purchased_users.py rename to src/products/tests/courses/tests_course_send_email_to_all_purchased_users.py index ec06e855020..93732052d65 100644 --- a/src/courses/tests/courses/tests_course_send_email_to_all_purchased_users.py +++ b/src/products/tests/courses/tests_course_send_email_to_all_purchased_users.py @@ -6,7 +6,7 @@ @pytest.fixture def course(mixer): - return mixer.blend('courses.Course') + return mixer.blend('products.Course') @pytest.fixture(autouse=True) diff --git a/src/courses/tests/price/conftest.py b/src/products/tests/price/conftest.py similarity index 50% rename from src/courses/tests/price/conftest.py rename to src/products/tests/price/conftest.py index be184b8ba9d..cee7c11f170 100644 --- a/src/courses/tests/price/conftest.py +++ b/src/products/tests/price/conftest.py @@ -5,4 +5,4 @@ @pytest.fixture(autouse=True) def record(mixer): - return mixer.blend('courses.Record', slug='home-video', price='100500.00', old_price='100500.95') + return mixer.blend('products.Record', slug='home-video', price='100500.00', old_price='100500.95') diff --git a/src/courses/tests/price/tests_bundle_api_price_reading.py b/src/products/tests/price/tests_bundle_api_price_reading.py similarity index 78% rename from src/courses/tests/price/tests_bundle_api_price_reading.py rename to src/products/tests/price/tests_bundle_api_price_reading.py index 8ce2ea8a9d1..d082df0f4c9 100644 --- a/src/courses/tests/price/tests_bundle_api_price_reading.py +++ b/src/products/tests/price/tests_bundle_api_price_reading.py @@ -5,7 +5,7 @@ @pytest.fixture def bundle(mixer): - return mixer.blend('courses.Bundle', slug='pinetree-tickets', name='Флаг и билет на ёлку', price='500', old_price='500.95') + return mixer.blend('products.Bundle', slug='pinetree-tickets', name='Флаг и билет на ёлку', price='500', old_price='500.95') def test_list(api, bundle): diff --git a/src/courses/tests/price/tests_course_api_price_reading.py b/src/products/tests/price/tests_course_api_price_reading.py similarity index 87% rename from src/courses/tests/price/tests_course_api_price_reading.py rename to src/products/tests/price/tests_course_api_price_reading.py index e7633457146..1eac7706504 100644 --- a/src/courses/tests/price/tests_course_api_price_reading.py +++ b/src/products/tests/price/tests_course_api_price_reading.py @@ -5,7 +5,7 @@ @pytest.fixture def course(mixer): - return mixer.blend('courses.Course', price='500', old_price='500.95') + return mixer.blend('products.Course', price='500', old_price='500.95') def test_list(api, course): diff --git a/src/courses/tests/price/tests_record_api_price_reading.py b/src/products/tests/price/tests_record_api_price_reading.py similarity index 87% rename from src/courses/tests/price/tests_record_api_price_reading.py rename to src/products/tests/price/tests_record_api_price_reading.py index ac16e1458d3..281905954ed 100644 --- a/src/courses/tests/price/tests_record_api_price_reading.py +++ b/src/products/tests/price/tests_record_api_price_reading.py @@ -5,7 +5,7 @@ @pytest.fixture def record(mixer): - return mixer.blend('courses.Record', price='500', old_price='500.95') + return mixer.blend('products.Record', price='500', old_price='500.95') def test_list(api, record): diff --git a/src/courses/tests/record_api/conftest.py b/src/products/tests/record_api/conftest.py similarity index 87% rename from src/courses/tests/record_api/conftest.py rename to src/products/tests/record_api/conftest.py index 9f90c8c9762..7f63325e275 100644 --- a/src/courses/tests/record_api/conftest.py +++ b/src/products/tests/record_api/conftest.py @@ -5,7 +5,7 @@ @pytest.fixture(autouse=True) def record(mixer): - return mixer.blend('courses.Record', slug='home-video', price=1900) + return mixer.blend('products.Record', slug='home-video', price=1900) @pytest.fixture(autouse=True) diff --git a/src/courses/tests/record_api/tests_purchasing_record.py b/src/products/tests/record_api/tests_purchasing_record.py similarity index 100% rename from src/courses/tests/record_api/tests_purchasing_record.py rename to src/products/tests/record_api/tests_purchasing_record.py diff --git a/src/courses/tests/record_api/tests_purchasing_record_with_promocode.py b/src/products/tests/record_api/tests_purchasing_record_with_promocode.py similarity index 100% rename from src/courses/tests/record_api/tests_purchasing_record_with_promocode.py rename to src/products/tests/record_api/tests_purchasing_record_with_promocode.py diff --git a/src/courses/tests/record_api/tests_record_api_reading.py b/src/products/tests/record_api/tests_record_api_reading.py similarity index 92% rename from src/courses/tests/record_api/tests_record_api_reading.py rename to src/products/tests/record_api/tests_record_api_reading.py index f09420c4825..554ca44442f 100644 --- a/src/courses/tests/record_api/tests_record_api_reading.py +++ b/src/products/tests/record_api/tests_record_api_reading.py @@ -5,7 +5,7 @@ @pytest.fixture def record(mixer): - return mixer.blend('courses.Record') + return mixer.blend('products.Record') @pytest.mark.parametrize('field', [ diff --git a/src/courses/tests/records/tests_record_get_absolute_url.py b/src/products/tests/records/tests_record_get_absolute_url.py similarity index 72% rename from src/courses/tests/records/tests_record_get_absolute_url.py rename to src/products/tests/records/tests_record_get_absolute_url.py index 909ecc2c7ee..6b0ad37cf3c 100644 --- a/src/courses/tests/records/tests_record_get_absolute_url.py +++ b/src/products/tests/records/tests_record_get_absolute_url.py @@ -10,10 +10,10 @@ def set_main_website(settings): @pytest.fixture def course(mixer): - return mixer.blend('courses.Course', slug='tst-slug') + return mixer.blend('products.Course', slug='tst-slug') def test(mixer, course): - record = mixer.blend('courses.Record', course=course) + record = mixer.blend('products.Record', course=course) assert record.get_absolute_url() == 'https://test.mocked/courses/tst-slug/' diff --git a/src/courses/tests/records/tests_record_get_template_id.py b/src/products/tests/records/tests_record_get_template_id.py similarity index 88% rename from src/courses/tests/records/tests_record_get_template_id.py rename to src/products/tests/records/tests_record_get_template_id.py index 961f2bf8553..4fc7a34bf89 100644 --- a/src/courses/tests/records/tests_record_get_template_id.py +++ b/src/products/tests/records/tests_record_get_template_id.py @@ -5,7 +5,7 @@ @pytest.fixture def record(mixer): - return mixer.blend('courses.Record') + return mixer.blend('products.Record') @pytest.mark.parametrize('template_id, expected', [ diff --git a/src/courses/tests/records/tests_record_str.py b/src/products/tests/records/tests_record_str.py similarity index 56% rename from src/courses/tests/records/tests_record_str.py rename to src/products/tests/records/tests_record_str.py index 671d6d8effa..5e99ff0ae57 100644 --- a/src/courses/tests/records/tests_record_str.py +++ b/src/products/tests/records/tests_record_str.py @@ -5,12 +5,12 @@ @pytest.fixture def course(mixer): - return mixer.blend('courses.Course', name='Упячивание бутявок', name_genitive='Упячивания бутявок') + return mixer.blend('products.Course', name='Упячивание бутявок', name_genitive='Упячивания бутявок') @pytest.fixture def record(course, mixer): - return mixer.blend('courses.Record', course=course) + return mixer.blend('products.Record', course=course) def test(record): diff --git a/src/courses/tests/shippable/tests_get_price.py b/src/products/tests/shippable/tests_get_price.py similarity index 85% rename from src/courses/tests/shippable/tests_get_price.py rename to src/products/tests/shippable/tests_get_price.py index 10d1dc37129..58f2377654f 100644 --- a/src/courses/tests/shippable/tests_get_price.py +++ b/src/products/tests/shippable/tests_get_price.py @@ -6,7 +6,7 @@ @pytest.fixture def record(mixer): - return mixer.blend('courses.Record', name='Запись курсов кройки и шитья', price=100500) + return mixer.blend('products.Record', name='Запись курсов кройки и шитья', price=100500) @pytest.fixture(autouse=True) diff --git a/src/shipping/shipments/base.py b/src/shipping/shipments/base.py index b8ccb1c9d1e..8328f6a967d 100644 --- a/src/shipping/shipments/base.py +++ b/src/shipping/shipments/base.py @@ -2,8 +2,8 @@ from abc import ABCMeta, abstractmethod -from courses.models import Bundle, Course, Record from orders.models import Order +from products.models import Bundle, Course, Record from users.models import User diff --git a/src/shipping/shipments/course.py b/src/shipping/shipments/course.py index d848f04e320..f1085735e30 100644 --- a/src/shipping/shipments/course.py +++ b/src/shipping/shipments/course.py @@ -1,7 +1,7 @@ from typing import Optional from app.tasks import invite_to_clickmeeting, invite_to_zoomus, send_mail -from courses.models import Course +from products.models import Course from shipping import factory from shipping.shipments.base import BaseShipment diff --git a/src/shipping/shipments/record.py b/src/shipping/shipments/record.py index a82f22afa75..b4ad711787b 100644 --- a/src/shipping/shipments/record.py +++ b/src/shipping/shipments/record.py @@ -1,7 +1,7 @@ from rest_framework import serializers from app.tasks import send_mail -from courses.models import Record +from products.models import Record from shipping import factory from shipping.shipments.base import BaseShipment diff --git a/src/shipping/test.py b/src/shipping/test.py index 8f78c33f8a2..49106b0e5d7 100644 --- a/src/shipping/test.py +++ b/src/shipping/test.py @@ -1,4 +1,4 @@ -from courses.models import Record +from products.models import Record from shipping.shipments import RecordShipment from users.models import User diff --git a/src/shipping/tests/course_shipment/conftest.py b/src/shipping/tests/course_shipment/conftest.py index c75424ca636..7d9b0b52185 100644 --- a/src/shipping/tests/course_shipment/conftest.py +++ b/src/shipping/tests/course_shipment/conftest.py @@ -9,7 +9,7 @@ @pytest.fixture def course(mixer): return mixer.blend( - 'courses.Course', + 'products.Course', name='Кройка и шитьё', name_genitive='Кройки и шитья', ) diff --git a/src/shipping/tests/record_shipment/conftest.py b/src/shipping/tests/record_shipment/conftest.py index b8a8be40fe6..a34773594eb 100644 --- a/src/shipping/tests/record_shipment/conftest.py +++ b/src/shipping/tests/record_shipment/conftest.py @@ -7,12 +7,12 @@ @pytest.fixture def course(mixer): - return mixer.blend('courses.Course', name='Кройка и шитьё', name_genitive='Кройки и шитья') + return mixer.blend('products.Course', name='Кройка и шитьё', name_genitive='Кройки и шитья') @pytest.fixture def record(mixer, course): - return mixer.blend('courses.Record', course=course) + return mixer.blend('products.Record', course=course) @pytest.fixture diff --git a/src/shipping/tests/shipping_factory/conftest.py b/src/shipping/tests/shipping_factory/conftest.py index 8fed7d42689..d26c1e80247 100644 --- a/src/shipping/tests/shipping_factory/conftest.py +++ b/src/shipping/tests/shipping_factory/conftest.py @@ -5,9 +5,9 @@ @pytest.fixture def course(mixer): - return mixer.blend('courses.Course', name='Кройка и шитьё', name_genitive='Кройки и шитья') + return mixer.blend('products.Course', name='Кройка и шитьё', name_genitive='Кройки и шитья') @pytest.fixture def record(mixer, course): - return mixer.blend('courses.Record', course=course) + return mixer.blend('products.Record', course=course) diff --git a/src/shipping/tests/tests_per_item_template_id.py b/src/shipping/tests/tests_per_item_template_id.py index ea189a5600b..d9011ea4308 100644 --- a/src/shipping/tests/tests_per_item_template_id.py +++ b/src/shipping/tests/tests_per_item_template_id.py @@ -7,7 +7,7 @@ @pytest.fixture def record(mixer): - return lambda template_id: mixer.blend('courses.Record', template_id=template_id) + return lambda template_id: mixer.blend('products.Record', template_id=template_id) @pytest.fixture diff --git a/src/tinkoff/tests/bank_client/conftest.py b/src/tinkoff/tests/bank_client/conftest.py index 267d65b041e..2bb0cca67ee 100644 --- a/src/tinkoff/tests/bank_client/conftest.py +++ b/src/tinkoff/tests/bank_client/conftest.py @@ -21,7 +21,7 @@ def absolute_host(settings): @pytest.fixture def record(mixer): return mixer.blend( - 'courses.Record', + 'products.Record', name='Пентакли и тентакли', name_receipt='Предоставление доступа к записи курса «Пентакли и Тентакли»', ) diff --git a/src/triggers/tests/conftest.py b/src/triggers/tests/conftest.py index 15263758b26..f9e22fe314a 100644 --- a/src/triggers/tests/conftest.py +++ b/src/triggers/tests/conftest.py @@ -12,17 +12,17 @@ def user(mixer): @pytest.fixture def course(mixer): - return mixer.blend('courses.Course', name='Курс кройки и шитья', full_name='Билет на курс кройки и шитья') + return mixer.blend('products.Course', name='Курс кройки и шитья', full_name='Билет на курс кройки и шитья') @pytest.fixture def record(mixer, course): - return mixer.blend('courses.Record', course=course) + return mixer.blend('products.Record', course=course) @pytest.fixture def bundle(mixer): - return mixer.blend('courses.Bundle') + return mixer.blend('products.Bundle') @pytest.fixture diff --git a/src/triggers/tests/started_purchase_trigger/tests_started_purchase_trigger_template_context.py b/src/triggers/tests/started_purchase_trigger/tests_started_purchase_trigger_template_context.py index 957ff2b0485..dd6538053d7 100644 --- a/src/triggers/tests/started_purchase_trigger/tests_started_purchase_trigger_template_context.py +++ b/src/triggers/tests/started_purchase_trigger/tests_started_purchase_trigger_template_context.py @@ -10,12 +10,12 @@ def fix_frontend_url(settings): @pytest.fixture def record(mixer, course): - return mixer.blend('courses.Record', course=course) + return mixer.blend('products.Record', course=course) @pytest.fixture def bundle(mixer, course): - bundle = mixer.blend('courses.Bundle') + bundle = mixer.blend('products.Bundle') bundle.courses.add(course) return bundle