Add unique_together = (('group_id', 'user_id', 'photo_md5'),) for GroupPhotoInfo

Brightcells 7 years ago
parent
commit
7060597dd6
2 changed files with 21 additions and 0 deletions
  1. 19 0
      group/migrations/0038_auto_20170821_1608.py
  2. 2 0
      group/models.py

+ 19 - 0
group/migrations/0038_auto_20170821_1608.py

@@ -0,0 +1,19 @@
1
+# -*- coding: utf-8 -*-
2
+# Generated by Django 1.11.3 on 2017-08-21 08:08
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', '0037_auto_20170821_1600'),
12
+    ]
13
+
14
+    operations = [
15
+        migrations.AlterUniqueTogether(
16
+            name='groupphotoinfo',
17
+            unique_together=set([('group_id', 'user_id', 'photo_md5')]),
18
+        ),
19
+    ]

+ 2 - 0
group/models.py

@@ -260,6 +260,8 @@ class GroupPhotoInfo(CreateUpdateMixin):
260 260
         verbose_name = _(u'groupphotoinfo')
261 261
         verbose_name_plural = _(u'groupphotoinfo')
262 262
 
263
+        unique_together = (('group_id', 'user_id', 'photo_md5'),)
264
+
263 265
     def __unicode__(self):
264 266
         return unicode(self.pk)
265 267