diff options
author | Matthew Lemon <y@yulqen.org> | 2025-01-07 22:01:44 +0000 |
---|---|---|
committer | Matthew Lemon <y@yulqen.org> | 2025-01-07 22:01:44 +0000 |
commit | ba381a9caf9ce7e6eb5731b340c4d208b44c2ca7 (patch) | |
tree | 89abdfa1f5937573596b1d852e7803f0ad3087df /alphabetlearning | |
parent | ed81f85afabf7d91a9badcd38865d43af77f483a (diff) |
wip: sorting out tests and factories
Diffstat (limited to 'alphabetlearning')
-rw-r--r-- | alphabetlearning/payments/migrations/0003_alter_price_price.py | 18 | ||||
-rw-r--r-- | alphabetlearning/payments/migrations/0004_alter_price_price.py | 18 | ||||
-rw-r--r-- | alphabetlearning/payments/models.py | 3 | ||||
-rw-r--r-- | alphabetlearning/payments/views.py | 1 | ||||
-rw-r--r-- | alphabetlearning/resources/factories.py | 1 |
5 files changed, 39 insertions, 2 deletions
diff --git a/alphabetlearning/payments/migrations/0003_alter_price_price.py b/alphabetlearning/payments/migrations/0003_alter_price_price.py new file mode 100644 index 0000000..3b69f8f --- /dev/null +++ b/alphabetlearning/payments/migrations/0003_alter_price_price.py @@ -0,0 +1,18 @@ +# Generated by Django 5.1.4 on 2025-01-06 20:55 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('payments', '0002_initial'), + ] + + operations = [ + migrations.AlterField( + model_name='price', + name='price', + field=models.DecimalField(decimal_places=2, default=0, max_digits=3), + ), + ] diff --git a/alphabetlearning/payments/migrations/0004_alter_price_price.py b/alphabetlearning/payments/migrations/0004_alter_price_price.py new file mode 100644 index 0000000..ae72dbf --- /dev/null +++ b/alphabetlearning/payments/migrations/0004_alter_price_price.py @@ -0,0 +1,18 @@ +# Generated by Django 5.1.4 on 2025-01-06 20:59 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('payments', '0003_alter_price_price'), + ] + + operations = [ + migrations.AlterField( + model_name='price', + name='price', + field=models.IntegerField(default=0), + ), + ] diff --git a/alphabetlearning/payments/models.py b/alphabetlearning/payments/models.py index 44c8597..12c82f4 100644 --- a/alphabetlearning/payments/models.py +++ b/alphabetlearning/payments/models.py @@ -1,13 +1,12 @@ import uuid from datetime import timedelta +from alphabetlearning.resources.models import Resource from django.conf import settings from django.core.exceptions import ValidationError from django.db import models from django.utils import timezone -from alphabetlearning.resources.models import Resource - class EmailVerification(models.Model): email = models.EmailField(unique=True) diff --git a/alphabetlearning/payments/views.py b/alphabetlearning/payments/views.py index cdfafe6..cf442d7 100644 --- a/alphabetlearning/payments/views.py +++ b/alphabetlearning/payments/views.py @@ -173,6 +173,7 @@ class ProductLandingPageView(TemplateView): @login_required def add_to_cart(request, resource_id): + breakpoint() resource = get_object_or_404(Resource, id=resource_id) if not resource.price_obj.first(): return HttpResponseBadRequest( diff --git a/alphabetlearning/resources/factories.py b/alphabetlearning/resources/factories.py index 47d86e2..e406a9d 100644 --- a/alphabetlearning/resources/factories.py +++ b/alphabetlearning/resources/factories.py @@ -40,6 +40,7 @@ class ResourceModelFactory(factory.django.DjangoModelFactory): thumbnail_filenames = factory.List( [factory.Faker("file_name", extension="jpg") for _ in range(3)] ) + # price_obj = factory.RelatedFactoryList("alphabetlearning.payments.factories.PriceFactory", size=1) resource_type = factory.SubFactory(ResourceTypeModelFactory) main_resource_category = factory.SubFactory(ResourceCategoryModelFactory) subcategories = factory.RelatedFactoryList(ResourceCategoryModelFactory, size=2) |