Add unique together for model

This commit is contained in:
cuom1999 2022-10-27 15:02:54 -05:00
parent f3bed03d8f
commit 6b83a1ff0d
3 changed files with 38 additions and 0 deletions

View file

@ -0,0 +1,18 @@
# Generated by Django 2.2.25 on 2022-10-27 20:00
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('judge', '0135_auto_20221028_0300'),
('chat_box', '0009_auto_20220618_1452'),
]
operations = [
migrations.AlterUniqueTogether(
name='userroom',
unique_together={('user', 'room')},
),
]

View file

@ -55,6 +55,8 @@ class UserRoom(models.Model):
) )
last_seen = models.DateTimeField(verbose_name=_("last seen"), auto_now_add=True) last_seen = models.DateTimeField(verbose_name=_("last seen"), auto_now_add=True)
class Meta:
unique_together = ("user", "room")
class Ignore(models.Model): class Ignore(models.Model):
user = models.OneToOneField( user = models.OneToOneField(

File diff suppressed because one or more lines are too long