Fakultas Ilmu Komputer UI

Commit a72ee740 authored by Muhammad Rafif Elfazri's avatar Muhammad Rafif Elfazri
Browse files

[REFACTOR] Add cosntraint unique pair (user, fasilitas) in Likes and Dislikes

parent 67f2e354
# Generated by Django 3.1.7 on 2021-06-01 06:31
from django.conf import settings
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('informasi_fasilitas', '0020_auto_20210601_0503'),
]
operations = [
migrations.AlterUniqueTogether(
name='dislikes',
unique_together={('user', 'fasilitas')},
),
migrations.AlterUniqueTogether(
name='likes',
unique_together={('user', 'fasilitas')},
),
]
......@@ -114,12 +114,18 @@ class Likes(models.Model):
fasilitas = models.ForeignKey(Fasilitas, on_delete=models.CASCADE)
created = models.DateTimeField(auto_now_add=True)
class Meta:
unique_together = ('user', 'fasilitas')
class Dislikes(models.Model):
objects = models.Manager()
user = models.ForeignKey(User, on_delete=models.CASCADE)
fasilitas = models.ForeignKey(Fasilitas, on_delete=models.CASCADE)
created = models.DateTimeField(auto_now_add=True)
class Meta:
unique_together = ('user', 'fasilitas')
class KomentarKegiatan(models.Model):
objects = models.Manager()
user = models.ForeignKey(User, on_delete=models.CASCADE)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment