Skip to content

Commit

Permalink
refactor(Prices): transform receipt_quantity field to Decimal
Browse files Browse the repository at this point in the history
  • Loading branch information
raphodn committed Jan 1, 2025
1 parent c62ccae commit 832f956
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
27 changes: 27 additions & 0 deletions open_prices/prices/migrations/0005_alter_price_receipt_quantity.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Generated by Django 5.1.4 on 2025-01-01 22:11

from decimal import Decimal

import django.core.validators
from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("prices", "0004_price_type"),
]

operations = [
migrations.AlterField(
model_name="price",
name="receipt_quantity",
field=models.DecimalField(
blank=True,
decimal_places=2,
max_digits=10,
null=True,
validators=[django.core.validators.MinValueValidator(Decimal("0"))],
verbose_name="Receipt's price quantity (user input)",
),
),
]
6 changes: 4 additions & 2 deletions open_prices/prices/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,11 @@ class Price(models.Model):
related_name="prices",
)

receipt_quantity = models.PositiveIntegerField(
receipt_quantity = models.DecimalField(
verbose_name="Receipt's price quantity (user input)",
validators=[MinValueValidator(1)],
max_digits=10,
decimal_places=2,
validators=[MinValueValidator(decimal.Decimal(0))],
blank=True,
null=True,
)
Expand Down

0 comments on commit 832f956

Please sign in to comment.