From 9a164d6bd3534fddb4db39fa8db3225660ca0514 Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Fri, 17 Oct 2014 22:48:16 -0400 Subject: [PATCH] Don't fail if the taggit app is not installed --- mayan/apps/tags/migrations/0003_remove_taggit.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/mayan/apps/tags/migrations/0003_remove_taggit.py b/mayan/apps/tags/migrations/0003_remove_taggit.py index 7b76252f27..5a1327f2ec 100644 --- a/mayan/apps/tags/migrations/0003_remove_taggit.py +++ b/mayan/apps/tags/migrations/0003_remove_taggit.py @@ -4,8 +4,6 @@ from south.db import db from south.v2 import DataMigration from django.db import models -from taggit.models import Tag as TaggitModel - class Migration(DataMigration): def forwards(self, orm): @@ -14,9 +12,14 @@ class Migration(DataMigration): # Use orm.ModelName to refer to models in this application, # and orm['appname.ModelName'] for models in other applications. - for tag in TaggitModel.objects.all(): - color = orm.TagProperties.objects.get(tag=tag).color - orm.Tag.objects.create(label=tag.name, color=color) + try: + from taggit.models import Tag as TaggitModel + except ImportError: + pass + else: + for tag in TaggitModel.objects.all(): + color = orm.TagProperties.objects.get(tag=tag).color + orm.Tag.objects.create(label=tag.name, color=color) def backwards(self, orm): "Write your backwards methods here."