gva/gnuviechadmin/managemails/migrations/0008_copy_existing_maildomains.py

94 lines
6.2 KiB
Python

# -*- coding: utf-8 -*-
# pymode:lint_ignore=E501
from south.v2 import DataMigration
class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."
OrigMailDomain = orm['managemails.MailDomain']
NewMailDomain = orm['domains.MailDomain']
for domain in OrigMailDomain.objects.all():
NewMailDomain(domain=domain.domain, id=domain.id, created=domain.created).save()
def backwards(self, orm):
"Write your backwards methods here."
OrigMailDomain = orm['domains.MailDomain']
NewMailDomain = orm['managemails.MailDomain']
for domain in OrigMailDomain.objects.all():
NewMailDomain(domain=domain.domain, id=domain.id, created=domain.created).save()
models = {
u'domains.maildomain': {
'Meta': {'object_name': 'MailDomain'},
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
'domain': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'})
},
u'managemails.maildomain': {
'Meta': {'object_name': 'MailDomain'},
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
'domain': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'})
},
u'managemails.mailaddress': {
'Meta': {'unique_together': "(('localpart', 'domain'),)", 'object_name': 'MailAddress'},
'active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
'domain': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['domains.MailDomain']"}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'localpart': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'})
},
u'managemails.mailaddressforward': {
'Meta': {'unique_together': "(('mailaddress', 'target'),)", 'object_name': 'MailAddressForward'},
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'mailaddress': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['managemails.MailAddress']"}),
'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'}),
'target': ('django.db.models.fields.EmailField', [], {'max_length': '254'})
},
u'managemails.mailaddressmailbox': {
'Meta': {'unique_together': "(('mailaddress', 'mailbox'),)", 'object_name': 'MailAddressMailbox'},
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
'mailaddress': ('django.db.models.fields.related.OneToOneField', [], {'to': u"orm['managemails.MailAddress']", 'unique': 'True', 'primary_key': 'True'}),
'mailbox': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['managemails.Mailbox']"}),
'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'})
},
u'managemails.mailbox': {
'Meta': {'object_name': 'Mailbox'},
'active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'}),
'osuser': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['osusers.User']"}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '128'})
},
u'osusers.group': {
'Meta': {'object_name': 'Group'},
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
'descr': ('django.db.models.fields.TextField', [], {'blank': 'True'}),
'gid': ('django.db.models.fields.PositiveSmallIntegerField', [], {'unique': 'True', 'primary_key': 'True'}),
'groupname': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '16'}),
'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'}),
'passwd': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'})
},
u'osusers.user': {
'Meta': {'object_name': 'User'},
'created': ('model_utils.fields.AutoCreatedField', [], {'default': 'datetime.datetime.now'}),
'gecos': ('django.db.models.fields.CharField', [], {'max_length': '128', 'blank': 'True'}),
'group': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['osusers.Group']"}),
'homedir': ('django.db.models.fields.CharField', [], {'max_length': '256'}),
'modified': ('model_utils.fields.AutoLastModifiedField', [], {'default': 'datetime.datetime.now'}),
'shell': ('django.db.models.fields.CharField', [], {'max_length': '64'}),
'uid': ('django.db.models.fields.PositiveSmallIntegerField', [], {'unique': 'True', 'primary_key': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '64'})
}
}
complete_apps = ['managemails']
symmetrical = True