Skip to content

Commit

Permalink
Rename courses app to products, pt. 2 (#100)
Browse files Browse the repository at this point in the history
  • Loading branch information
f213 committed Jan 3, 2021
1 parent c08a838 commit 80b4b43
Show file tree
Hide file tree
Showing 86 changed files with 113 additions and 107 deletions.
2 changes: 1 addition & 1 deletion src/app/settings.py
Expand Up @@ -64,7 +64,7 @@
'app',
'users',
'orders',
'courses',
'products',
'shipping',
'tinkoff',
'triggers',
Expand Down
2 changes: 1 addition & 1 deletion src/app/urls.py
Expand Up @@ -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

Expand Down
2 changes: 0 additions & 2 deletions src/courses/admin/__init__.py

This file was deleted.

9 changes: 0 additions & 9 deletions src/courses/models/__init__.py

This file was deleted.

6 changes: 3 additions & 3 deletions src/orders/migrations/0001_initial.py
Expand Up @@ -13,7 +13,7 @@ class Migration(migrations.Migration):
initial = True

dependencies = [
('courses', '0002_CourseGenitiveName'),
('products', '0002_CourseGenitiveName'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]

Expand All @@ -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={
Expand Down
4 changes: 2 additions & 2 deletions src/orders/migrations/0003_OrderBundles.py
Expand Up @@ -10,14 +10,14 @@
class Migration(migrations.Migration):

dependencies = [
('courses', '0008_Bundles'),
('products', '0008_Bundles'),
('orders', '0002_L18N'),
]

operations = [
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'),
),
]
8 changes: 4 additions & 4 deletions src/orders/migrations/0010_OrderI18n.py
Expand Up @@ -11,20 +11,20 @@ class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('courses', '0014_CourseWelcomeLetter'),
('products', '0014_CourseWelcomeLetter'),
('orders', '0009_Gifts'),
]

operations = [
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',
Expand All @@ -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',
Expand Down
6 changes: 3 additions & 3 deletions src/orders/models/order.py
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions src/orders/tests/conftest.py
Expand Up @@ -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')
2 changes: 1 addition & 1 deletion src/orders/tests/order_shipping/conftest.py
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/orders/tests/promocode/tests_price_with_promocode.py
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/orders/tests/test_shipping_unshipped_orders.py
Expand Up @@ -11,7 +11,7 @@

@pytest.fixture
def product(mixer):
return mixer.blend('courses.Record')
return mixer.blend('products.Record')


@pytest.fixture
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions src/products/admin/__init__.py
@@ -0,0 +1,2 @@
import products.admin.bundle # noqa
import products.admin.course # noqa
@@ -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)
Expand Down
6 changes: 3 additions & 3 deletions src/courses/admin/course.py → 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)
Expand Down
File renamed without changes.
Expand Up @@ -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):
Expand Down
@@ -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):
Expand Down
4 changes: 2 additions & 2 deletions src/courses/api/viewsets.py → 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):
Expand Down
File renamed without changes.
Expand Up @@ -23,6 +23,7 @@ class Migration(migrations.Migration):
],
options={
'abstract': False,
'db_table': 'courses_course',
},
),
migrations.CreateModel(
Expand All @@ -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',
},
),
]
Expand Up @@ -6,7 +6,7 @@
class Migration(migrations.Migration):

dependencies = [
('courses', '0001_initial'),
('products', '0001_initial'),
]

operations = [
Expand Down
Expand Up @@ -6,7 +6,7 @@
class Migration(migrations.Migration):

dependencies = [
('courses', '0002_CourseGenitiveName'),
('products', '0002_CourseGenitiveName'),
]

operations = [
Expand Down
Expand Up @@ -6,7 +6,7 @@
class Migration(migrations.Migration):

dependencies = [
('courses', '0003_DefaultOrdering'),
('products', '0003_DefaultOrdering'),
]

operations = [
Expand Down
Expand Up @@ -6,7 +6,7 @@
class Migration(migrations.Migration):

dependencies = [
('courses', '0004_ReceiptNames'),
('products', '0004_ReceiptNames'),
]

operations = [
Expand Down
Expand Up @@ -6,7 +6,7 @@
class Migration(migrations.Migration):

dependencies = [
('courses', '0005_ClickMeeetingRoomURL'),
('products', '0005_ClickMeeetingRoomURL'),
]

operations = [
Expand Down
Expand Up @@ -6,7 +6,7 @@
class Migration(migrations.Migration):

dependencies = [
('courses', '0006_ShippableFullName'),
('products', '0006_ShippableFullName'),
]

operations = [
Expand Down
Expand Up @@ -6,7 +6,7 @@
class Migration(migrations.Migration):

dependencies = [
('courses', '0007_L18N'),
('products', '0007_L18N'),
]

operations = [
Expand All @@ -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',
},
),
]
Expand Up @@ -6,7 +6,7 @@
class Migration(migrations.Migration):

dependencies = [
('courses', '0007_L18N'),
('products', '0007_L18N'),
]

operations = [
Expand Down
Expand Up @@ -6,8 +6,8 @@
class Migration(migrations.Migration):

dependencies = [
('courses', '0008_Bundles'),
('courses', '0008_CustomTemplateId'),
('products', '0008_Bundles'),
('products', '0008_CustomTemplateId'),
]

operations = [
Expand Down
Expand Up @@ -6,7 +6,7 @@
class Migration(migrations.Migration):

dependencies = [
('courses', '0009_merge_20191222_1525'),
('products', '0009_merge_20191222_1525'),
]

operations = [
Expand Down
Expand Up @@ -6,7 +6,7 @@
class Migration(migrations.Migration):

dependencies = [
('courses', '0010_ParentShippableModel'),
('products', '0010_ParentShippableModel'),
]

operations = [
Expand Down
Expand Up @@ -6,7 +6,7 @@
class Migration(migrations.Migration):

dependencies = [
('courses', '0011_Price'),
('products', '0011_Price'),
]

operations = [
Expand Down
Expand Up @@ -6,7 +6,7 @@
class Migration(migrations.Migration):

dependencies = [
('courses', '0012_ZoomusWebinarId'),
('products', '0012_ZoomusWebinarId'),
]

operations = [
Expand Down
Expand Up @@ -6,7 +6,7 @@
class Migration(migrations.Migration):

dependencies = [
('courses', '0013_TemplateIdRename'),
('products', '0013_TemplateIdRename'),
]

operations = [
Expand Down
Expand Up @@ -6,7 +6,7 @@
class Migration(migrations.Migration):

dependencies = [
('courses', '0014_CourseWelcomeLetter'),
('products', '0014_CourseWelcomeLetter'),
]

operations = [
Expand Down
File renamed without changes.
9 changes: 9 additions & 0 deletions 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,
]
File renamed without changes.

0 comments on commit 80b4b43

Please sign in to comment.