add back some unique constrains
This commit is contained in:
parent
fad9147f35
commit
49e8fb8d36
2 changed files with 44 additions and 9 deletions
38
journal/migrations/0003_auto_20230113_0506.py
Normal file
38
journal/migrations/0003_auto_20230113_0506.py
Normal file
|
@ -0,0 +1,38 @@
|
|||
# Generated by Django 3.2.16 on 2023-01-12 21:06
|
||||
|
||||
import catalog.common.utils
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("catalog", "0002_initial"),
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
("journal", "0002_initial"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="collection",
|
||||
name="cover",
|
||||
field=models.ImageField(
|
||||
blank=True,
|
||||
default="item/default.svg",
|
||||
upload_to=catalog.common.utils.piece_cover_path,
|
||||
),
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name="rating",
|
||||
unique_together={("owner", "item")},
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name="shelfmember",
|
||||
unique_together={("parent", "item")},
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name="tagmember",
|
||||
unique_together={("parent", "item")},
|
||||
),
|
||||
]
|
|
@ -245,9 +245,8 @@ class Review(Content):
|
|||
|
||||
|
||||
class Rating(Content):
|
||||
# class Meta:
|
||||
# unique_together = [["owner", "item"]]
|
||||
# FIXME enable after migration
|
||||
class Meta:
|
||||
unique_together = [["owner", "item"]]
|
||||
|
||||
grade = models.PositiveSmallIntegerField(
|
||||
default=0, validators=[MaxValueValidator(10), MinValueValidator(1)], null=True
|
||||
|
@ -487,9 +486,8 @@ class ShelfMember(ListMember):
|
|||
"Shelf", related_name="members", on_delete=models.CASCADE
|
||||
)
|
||||
|
||||
# class Meta:
|
||||
# unique_together = [["parent", "item"]]
|
||||
# FIXME enable after migration
|
||||
class Meta:
|
||||
unique_together = [["parent", "item"]]
|
||||
|
||||
@cached_property
|
||||
def mark(self):
|
||||
|
@ -702,9 +700,8 @@ Tag
|
|||
class TagMember(ListMember):
|
||||
parent = models.ForeignKey("Tag", related_name="members", on_delete=models.CASCADE)
|
||||
|
||||
# class Meta:
|
||||
# unique_together = [["parent", "item"]]
|
||||
# FIXME enable after migration
|
||||
class Meta:
|
||||
unique_together = [["parent", "item"]]
|
||||
|
||||
|
||||
TagValidators = [RegexValidator(regex=r"\s+", inverse_match=True)]
|
||||
|
|
Loading…
Add table
Reference in a new issue