mirror of
https://github.com/evennia/evennia.git
synced 2026-03-21 15:26:30 +01:00
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:
commit
acdea41a67
19 changed files with 601 additions and 468 deletions
|
|
@ -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):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue