Fix unique date field on snapshots
This commit is contained in:
parent
2ac316aaca
commit
7d0ed1dd5a
2 changed files with 20 additions and 1 deletions
19
nummi/main/migrations/0012_alter_snapshot_date.py
Normal file
19
nummi/main/migrations/0012_alter_snapshot_date.py
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
# Generated by Django 4.1.4 on 2022-12-29 18:22
|
||||||
|
|
||||||
|
import datetime
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
("main", "0011_alter_category_user_alter_invoice_user_and_more"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="snapshot",
|
||||||
|
name="date",
|
||||||
|
field=models.DateField(default=datetime.date.today, verbose_name="Date"),
|
||||||
|
),
|
||||||
|
]
|
|
@ -189,7 +189,7 @@ def snapshot_path(instance, filename):
|
||||||
|
|
||||||
class Snapshot(UserModel):
|
class Snapshot(UserModel):
|
||||||
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||||||
date = models.DateField(default=date.today, unique=True, verbose_name=_("Date"))
|
date = models.DateField(default=date.today, verbose_name=_("Date"))
|
||||||
value = models.DecimalField(
|
value = models.DecimalField(
|
||||||
max_digits=12, decimal_places=2, default=0, verbose_name=_("Value")
|
max_digits=12, decimal_places=2, default=0, verbose_name=_("Value")
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in a new issue