You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

0002_change_thumbnail_unique_constraint.py 2.0 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. # -*- coding: utf-8 -*-
  2. import datetime
  3. from south.db import db
  4. from south.v2 import SchemaMigration
  5. from django.db import models
  6. class Migration(SchemaMigration):
  7. def forwards(self, orm):
  8. # Removing unique constraint on 'Thumbnail', fields ['image', 'size']
  9. db.delete_unique(u'django_images_thumbnail', ['image', 'size'])
  10. # Adding unique constraint on 'Thumbnail', fields ['original', 'size']
  11. db.create_unique(u'django_images_thumbnail', ['original_id', 'size'])
  12. def backwards(self, orm):
  13. # Removing unique constraint on 'Thumbnail', fields ['original', 'size']
  14. db.delete_unique(u'django_images_thumbnail', ['original_id', 'size'])
  15. # Adding unique constraint on 'Thumbnail', fields ['image', 'size']
  16. db.create_unique(u'django_images_thumbnail', ['image', 'size'])
  17. models = {
  18. u'django_images.image': {
  19. 'Meta': {'object_name': 'Image'},
  20. 'height': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
  21. u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  22. 'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '255'}),
  23. 'width': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'})
  24. },
  25. u'django_images.thumbnail': {
  26. 'Meta': {'unique_together': "(('original', 'size'),)", 'object_name': 'Thumbnail'},
  27. 'height': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
  28. u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
  29. 'image': ('django.db.models.fields.files.ImageField', [], {'max_length': '255'}),
  30. 'original': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['django_images.Image']"}),
  31. 'size': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
  32. 'width': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'})
  33. }
  34. }
  35. complete_apps = ['django_images']