Editions are unique if name, platform OR year is different
This commit is contained in:
parent
76fbc39fed
commit
6329d380b7
|
@ -0,0 +1,17 @@
|
|||
# Generated by Django 4.2.7 on 2023-11-28 13:43
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
("games", "0032_alter_session_options_session_modified_at_and_more"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterUniqueTogether(
|
||||
name="edition",
|
||||
unique_together={("name", "platform", "year_released")},
|
||||
),
|
||||
]
|
|
@ -34,7 +34,7 @@ class Game(models.Model):
|
|||
|
||||
class Edition(models.Model):
|
||||
class Meta:
|
||||
unique_together = [["name", "platform"]]
|
||||
unique_together = [["name", "platform", "year_released"]]
|
||||
|
||||
game = models.ForeignKey("Game", on_delete=models.CASCADE)
|
||||
name = models.CharField(max_length=255)
|
||||
|
|
Loading…
Reference in New Issue