Add unique_together = (('photo_id', 'user_id'),) for PhotoThumbUpInfo

Brightcells 7 年之前
父節點
當前提交
9f4c919c29
共有 2 個文件被更改,包括 21 次插入0 次删除
  1. 19 0
      group/migrations/0039_auto_20170821_1613.py
  2. 2 0
      group/models.py

+ 19 - 0
group/migrations/0039_auto_20170821_1613.py

@@ -0,0 +1,19 @@
1
+# -*- coding: utf-8 -*-
2
+# Generated by Django 1.11.3 on 2017-08-21 08:13
3
+from __future__ import unicode_literals
4
+
5
+from django.db import migrations
6
+
7
+
8
+class Migration(migrations.Migration):
9
+
10
+    dependencies = [
11
+        ('group', '0038_auto_20170821_1608'),
12
+    ]
13
+
14
+    operations = [
15
+        migrations.AlterUniqueTogether(
16
+            name='photothumbupinfo',
17
+            unique_together=set([('photo_id', 'user_id')]),
18
+        ),
19
+    ]

+ 2 - 0
group/models.py

@@ -406,6 +406,8 @@ class PhotoThumbUpInfo(CreateUpdateMixin):
406 406
         verbose_name = _(u'photothumbupinfo')
407 407
         verbose_name_plural = _(u'photothumbupinfo')
408 408
 
409
+        unique_together = (('photo_id', 'user_id'),)
410
+
409 411
     def __unicode__(self):
410 412
         return unicode(self.pk)
411 413