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

@ -8,7 +8,7 @@ class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."
# Note: Don't use "from appname.models import ModelName".
# 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.
ChannelDB = orm['comms.ChannelDB']
@ -28,8 +28,12 @@ class Migration(DataMigration):
new_channel.db_attributes.add(keep_log)
for name in [alias.strip() for alias in
channel.db_aliases.split(',')]:
tag = Tag(db_key=name, db_category='comm_alias')
tag.save()
tag = Tag.objects.filter(db_key=name.lower().strip(), db_category='comm_alias')
if tag:
tag = tag[0]
else:
tag = Tag(db_key=name.lower().strip(), db_category='comm_alias')
tag.save()
new_channel.db_tags.add(tag)
new_channel.save()

View file

@ -342,10 +342,6 @@ class ChannelDB(TypedObject):
_typeclass_paths = settings.COMM_TYPECLASS_PATHS
_default_typeclass_path = settings.BASE_COMM_TYPECLASS or "src.comms.comms.Comm"
class Meta:
"Define Django meta options"
verbose_name = "Channel"
def __init__(self, *args, **kwargs):
TypedObject.__init__(self, *args, **kwargs)
_SA(self, "tags", TagHandler(self, category_prefix="comm_"))