Fixed a regression in the install process with south.
This commit is contained in:
parent
f68523cc22
commit
7995c91eee
1 changed files with 10 additions and 6 deletions
|
|
@ -4,6 +4,7 @@ from south.db import db
|
||||||
from south.v2 import SchemaMigration
|
from south.v2 import SchemaMigration
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from src.objects.models import ObjectDB
|
from src.objects.models import ObjectDB
|
||||||
|
from south import orm
|
||||||
|
|
||||||
class Migration(SchemaMigration):
|
class Migration(SchemaMigration):
|
||||||
|
|
||||||
|
|
@ -12,10 +13,13 @@ class Migration(SchemaMigration):
|
||||||
# Adding field 'ObjectDB.db_destination'
|
# Adding field 'ObjectDB.db_destination'
|
||||||
db.add_column('objects_objectdb', 'db_destination', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='destinations_set', null=True, to=orm['objects.ObjectDB']), keep_default=False)
|
db.add_column('objects_objectdb', 'db_destination', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='destinations_set', null=True, to=orm['objects.ObjectDB']), keep_default=False)
|
||||||
|
|
||||||
# move all exits to the new property
|
#move all exits to the new property
|
||||||
for exi in ObjectDB.objects.get_objs_with_attr('_destination'):
|
if not db.dry_run:
|
||||||
exi.destination = exi.db._destination
|
#for exi in ObjectDB.objects.get_objs_with_attr('_destination'):
|
||||||
exi.del_attribute('_destination')
|
#for exi in orm["objects.ObjAttribute"].objects.get_objs_with_attr('_destination'):
|
||||||
|
for exi in orm["objects.ObjAttribute"].objects.select_related("db_obj").filter(db_key="_destination").values_list('db_obj'):
|
||||||
|
exi.destination = exi.db._destination
|
||||||
|
exi.del_attribute('_destination')
|
||||||
|
|
||||||
def backwards(self, orm):
|
def backwards(self, orm):
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue