aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2025-01-06 17:14:10 +0000
committerMatthew Lemon <y@yulqen.org>2025-01-06 17:14:10 +0000
commitd98250037d43cd6a0d5f613ea70bb57bd17c1ab1 (patch)
tree525d3e95fd88fc9dad653afaceb675b85a803f06
parentb38b3b9392a62b048bef37d577b95e0286c99f7d (diff)
Adds price to Resource model
- the test_forms tests now pass - fixed some imports too here
Diffstat (limited to '')
-rw-r--r--alphabetlearning/resources/migrations/0002_resource_price.py18
-rw-r--r--alphabetlearning/resources/models.py14
-rw-r--r--alphabetlearning/resources/tests/test_forms.py2
3 files changed, 26 insertions, 8 deletions
diff --git a/alphabetlearning/resources/migrations/0002_resource_price.py b/alphabetlearning/resources/migrations/0002_resource_price.py
new file mode 100644
index 0000000..899be2c
--- /dev/null
+++ b/alphabetlearning/resources/migrations/0002_resource_price.py
@@ -0,0 +1,18 @@
+# Generated by Django 5.1.4 on 2025-01-06 17:13
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('resources', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='resource',
+ name='price',
+ field=models.DecimalField(decimal_places=2, default=0.0, max_digits=6),
+ ),
+ ]
diff --git a/alphabetlearning/resources/models.py b/alphabetlearning/resources/models.py
index 6881483..f5c3223 100644
--- a/alphabetlearning/resources/models.py
+++ b/alphabetlearning/resources/models.py
@@ -38,13 +38,13 @@ DESC_HELP_TEXT = """
class Resource(models.Model):
name = models.CharField(max_length=255, null=False)
stripe_product_id = models.CharField(max_length=100)
- # price = models.DecimalField(
- # max_digits=6,
- # decimal_places=2,
- # default=0.00,
- # null=False,
- # blank=False,
- # )
+ price = models.DecimalField(
+ max_digits=6,
+ decimal_places=2,
+ default=0.00,
+ null=False,
+ blank=False,
+ )
thumbnail_filenames = models.JSONField(
null=False,
verbose_name="Thumbnail filenames",
diff --git a/alphabetlearning/resources/tests/test_forms.py b/alphabetlearning/resources/tests/test_forms.py
index 66d6d43..465dc58 100644
--- a/alphabetlearning/resources/tests/test_forms.py
+++ b/alphabetlearning/resources/tests/test_forms.py
@@ -53,7 +53,7 @@ class ResourceCreateFormTest(TestCase):
@pytest.mark.django_db()
def test_featured_slots_must_be_unique(self):
- r1 = ResourceModelFactory(feature_slot=1)
+ _ = ResourceModelFactory(feature_slot=1)
with pytest.raises(IntegrityError):
ResourceModelFactory(feature_slot=1)