Fixed migrations.

see #292
This commit is contained in:
Antoine Nguyen
2012-07-10 07:38:13 +02:00
parent e568c2c711
commit 74f13d3063
2 changed files with 9 additions and 4 deletions
@@ -3,6 +3,7 @@ import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from django.core.exceptions import ObjectDoesNotExist
class Migration(DataMigration):
@@ -10,7 +11,7 @@ class Migration(DataMigration):
"Write your forwards methods here."
try:
ext = orm["admin.Extension"].objects.get(name="amavis_quarantine")
except orm["admin.Extension"].DoesNotExist:
except ObjectDoesNotExist:
return
ext.name = "amavis"
ext.save()
@@ -19,7 +20,7 @@ class Migration(DataMigration):
"Write your backwards methods here."
try:
ext = orm["admin.Extension"].objects.get(name="amavis")
except orm["admin.Extension"].DoesNotExist:
except ObjectDoesNotExist:
return
ext.name = "amavis_quarantine"
ext.save()
@@ -3,6 +3,7 @@ import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
from django.core.exceptions import ObjectDoesNotExist
class Migration(DataMigration):
@@ -14,8 +15,11 @@ class Migration(DataMigration):
spam_modifies_subj=None)
for dom in orm["admin.Domain"].objects.all():
orm["amavis.Users"].objects.create(email="@%s" % dom.name, fullname=dom.name,
local='1', priority=7, policy_id=1)
ext = orm["admin.Extension"].objects.get(name="amavis")
priority=7, policy_id=1)
try:
ext = orm["admin.Extension"].objects.get(name="amavis")
except ObjectDoesNotExist:
return
if ext.enabled:
for dom in orm["admin.Domain"].objects.all():
u = orm["amavis.Users"].objects.get(email="@%s" % dom.name)