Merge from Kelketek's clone. Added fixes to migrations of Tags. Issues with ContentTypes meaning that this revision is not possible to start.

This commit is contained in:
Griatch 2013-10-17 23:44:52 +02:00
commit acdea41a67
19 changed files with 601 additions and 468 deletions

View file

@ -11,11 +11,16 @@ class Migration(DataMigration):
# Note: Don't use "from appname.models import ModelName".
# Use orm.ModelName to refer to models in this application,
# and orm['appname.ModelName'] for models in other applications.
Tag = orm['typeclasses.Tag']
for obj in orm.ScriptDB.objects.all():
if obj.db_permissions:
for perm in [perm.strip() for perm in obj.db_permissions.split(",")]:
tag = orm['typeclasses.Tag'].create(db_key=perm, db_category="permissions")
tag.save()
tag = Tag.objects.filter(db_key=perm.lower().strip(), db_category="permissions")
if tag:
tag = tag[0]
else:
tag = Tag(db_key=perm.lower().strip(), db_category="permissions")
tag.save()
obj.db_tags.add(tag)
def backwards(self, orm):