Permalink
Browse files

Add Django 1.7-compatible migrations

  • Loading branch information...
matthiask committed Jul 22, 2014
1 parent 5b365cf commit 15c86eae362472165881531d3d5edd957aa5ee70
@@ -1,90 +1,56 @@
# -*- coding: utf-8 -*-
-import datetime
-from south.db import db
-from south.v2 import SchemaMigration
-from django.db import models
-
-
-class Migration(SchemaMigration):
-
- def forwards(self, orm):
- # Adding model 'Banner'
- db.create_table('feincms_banners_banner', (
- ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
- ('is_active', self.gf('django.db.models.fields.BooleanField')(default=True)),
- ('name', self.gf('django.db.models.fields.CharField')(max_length=100)),
- ('mediafile', self.gf('feincms.module.medialibrary.fields.MediaFileForeignKey')(to=orm['medialibrary.MediaFile'])),
- ('url', self.gf('django.db.models.fields.URLField')(max_length=200)),
- ('type', self.gf('django.db.models.fields.CharField')(max_length=20)),
- ('code', self.gf('django.db.models.fields.CharField')(default='-z0g3hknx89_h83ko8ybt2wb3s_8tdsiy9hdwpw0', unique=True, max_length=40)),
- ('active_from', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)),
- ('active_until', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
- ('embeds', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)),
- ('impressions', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)),
- ))
- db.send_create_signal('feincms_banners', ['Banner'])
-
- # Adding model 'Click'
- db.create_table('feincms_banners_click', (
- ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
- ('banner', self.gf('django.db.models.fields.related.ForeignKey')(related_name='clicks', to=orm['feincms_banners.Banner'])),
- ('timestamp', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)),
- ('ip', self.gf('django.db.models.fields.IPAddressField')(max_length=15, null=True, blank=True)),
- ('user_agent', self.gf('django.db.models.fields.TextField')(default='', blank=True)),
- ('referrer', self.gf('django.db.models.fields.TextField')(default='', blank=True)),
- ))
- db.send_create_signal('feincms_banners', ['Click'])
-
-
- def backwards(self, orm):
- # Deleting model 'Banner'
- db.delete_table('feincms_banners_banner')
-
- # Deleting model 'Click'
- db.delete_table('feincms_banners_click')
-
-
- models = {
- 'feincms_banners.banner': {
- 'Meta': {'ordering': "['-active_from']", 'object_name': 'Banner'},
- 'active_from': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
- 'active_until': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
- 'code': ('django.db.models.fields.CharField', [], {'default': "'7u186cw9yz-nbyxc56kaua_e5elyurd7642pb14o'", 'unique': 'True', 'max_length': '40'}),
- 'embeds': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'impressions': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
- 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
- 'mediafile': ('feincms.module.medialibrary.fields.MediaFileForeignKey', [], {'to': "orm['medialibrary.MediaFile']"}),
- 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
- 'type': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
- 'url': ('django.db.models.fields.URLField', [], {'max_length': '200'})
- },
- 'feincms_banners.click': {
- 'Meta': {'ordering': "['-timestamp']", 'object_name': 'Click'},
- 'banner': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'clicks'", 'to': "orm['feincms_banners.Banner']"}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'ip': ('django.db.models.fields.IPAddressField', [], {'max_length': '15', 'null': 'True', 'blank': 'True'}),
- 'referrer': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
- 'timestamp': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
- 'user_agent': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'})
- },
- 'medialibrary.category': {
- 'Meta': {'ordering': "['parent__title', 'title']", 'object_name': 'Category'},
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['medialibrary.Category']"}),
- 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '150'}),
- 'title': ('django.db.models.fields.CharField', [], {'max_length': '200'})
- },
- 'medialibrary.mediafile': {
- 'Meta': {'ordering': "['-created']", 'object_name': 'MediaFile'},
- 'categories': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['medialibrary.Category']", 'null': 'True', 'blank': 'True'}),
- 'copyright': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
- 'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
- 'file': ('django.db.models.fields.files.FileField', [], {'max_length': '255'}),
- 'file_size': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
- 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
- 'type': ('django.db.models.fields.CharField', [], {'max_length': '12'})
- }
- }
-
- complete_apps = ['feincms_banners']
+from __future__ import unicode_literals
+
+from django.db import models, migrations
+import django.utils.timezone
+import feincms_banners.models
+import feincms.module.medialibrary.fields
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('medialibrary', '__latest__'),
+ ]
+
+ operations = [
+ migrations.CreateModel(
+ name='Banner',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('is_active', models.BooleanField(default=True, verbose_name='is active')),
+ ('name', models.CharField(help_text='Only for internal use, will not be shown on the website.', max_length=100, verbose_name='name')),
+ ('url', models.URLField(verbose_name='URL')),
+ ('type', models.CharField(max_length=20, verbose_name='type', choices=[('skyscraper', 'skyscraper'), ('leaderboard', 'leaderboard'), ('box', 'box')])),
+ ('code', models.CharField(default=feincms_banners.models.generate_key, unique=True, max_length=40, verbose_name='code')),
+ ('active_from', models.DateTimeField(default=django.utils.timezone.now, verbose_name='active from')),
+ ('active_until', models.DateTimeField(null=True, verbose_name='active until', blank=True)),
+ ('embeds', models.PositiveIntegerField(default=0, help_text='How many times has this banner been embdedded on a website?', verbose_name='embeds', editable=False)),
+ ('impressions', models.PositiveIntegerField(default=0, help_text='How many times has an impression been registered using a Javascript callback, verifying that it actually was a browser? (Too low because of network issues and deactivated Javascript support in some browsers.)', verbose_name='impressions', editable=False)),
+ ('mediafile', feincms.module.medialibrary.fields.MediaFileForeignKey(verbose_name='media file', to='medialibrary.MediaFile')),
+ ],
+ options={
+ 'ordering': ['-active_from'],
+ 'verbose_name': 'banner',
+ 'verbose_name_plural': 'banners',
+ },
+ bases=(models.Model,),
+ ),
+ migrations.CreateModel(
+ name='Click',
+ fields=[
+ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+ ('timestamp', models.DateTimeField(default=django.utils.timezone.now, verbose_name='timestamp')),
+ ('ip', models.IPAddressField(null=True, verbose_name='IP', blank=True)),
+ ('user_agent', models.TextField(default='', verbose_name='user agent', blank=True)),
+ ('referrer', models.TextField(default='', verbose_name='referrer', blank=True)),
+ ('banner', models.ForeignKey(verbose_name='banner', to='feincms_banners.Banner')),
+ ],
+ options={
+ 'ordering': ['-timestamp'],
+ 'verbose_name': 'click',
+ 'verbose_name_plural': 'clicks',
+ },
+ bases=(models.Model,),
+ ),
+ ]
@@ -0,0 +1,90 @@
+# -*- coding: utf-8 -*-
+import datetime
+from south.db import db
+from south.v2 import SchemaMigration
+from django.db import models
+
+
+class Migration(SchemaMigration):
+
+ def forwards(self, orm):
+ # Adding model 'Banner'
+ db.create_table('feincms_banners_banner', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('is_active', self.gf('django.db.models.fields.BooleanField')(default=True)),
+ ('name', self.gf('django.db.models.fields.CharField')(max_length=100)),
+ ('mediafile', self.gf('feincms.module.medialibrary.fields.MediaFileForeignKey')(to=orm['medialibrary.MediaFile'])),
+ ('url', self.gf('django.db.models.fields.URLField')(max_length=200)),
+ ('type', self.gf('django.db.models.fields.CharField')(max_length=20)),
+ ('code', self.gf('django.db.models.fields.CharField')(default='-z0g3hknx89_h83ko8ybt2wb3s_8tdsiy9hdwpw0', unique=True, max_length=40)),
+ ('active_from', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)),
+ ('active_until', self.gf('django.db.models.fields.DateTimeField')(null=True, blank=True)),
+ ('embeds', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)),
+ ('impressions', self.gf('django.db.models.fields.PositiveIntegerField')(default=0)),
+ ))
+ db.send_create_signal('feincms_banners', ['Banner'])
+
+ # Adding model 'Click'
+ db.create_table('feincms_banners_click', (
+ ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
+ ('banner', self.gf('django.db.models.fields.related.ForeignKey')(related_name='clicks', to=orm['feincms_banners.Banner'])),
+ ('timestamp', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)),
+ ('ip', self.gf('django.db.models.fields.IPAddressField')(max_length=15, null=True, blank=True)),
+ ('user_agent', self.gf('django.db.models.fields.TextField')(default='', blank=True)),
+ ('referrer', self.gf('django.db.models.fields.TextField')(default='', blank=True)),
+ ))
+ db.send_create_signal('feincms_banners', ['Click'])
+
+
+ def backwards(self, orm):
+ # Deleting model 'Banner'
+ db.delete_table('feincms_banners_banner')
+
+ # Deleting model 'Click'
+ db.delete_table('feincms_banners_click')
+
+
+ models = {
+ 'feincms_banners.banner': {
+ 'Meta': {'ordering': "['-active_from']", 'object_name': 'Banner'},
+ 'active_from': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'active_until': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'}),
+ 'code': ('django.db.models.fields.CharField', [], {'default': "'7u186cw9yz-nbyxc56kaua_e5elyurd7642pb14o'", 'unique': 'True', 'max_length': '40'}),
+ 'embeds': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'impressions': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}),
+ 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
+ 'mediafile': ('feincms.module.medialibrary.fields.MediaFileForeignKey', [], {'to': "orm['medialibrary.MediaFile']"}),
+ 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
+ 'type': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
+ 'url': ('django.db.models.fields.URLField', [], {'max_length': '200'})
+ },
+ 'feincms_banners.click': {
+ 'Meta': {'ordering': "['-timestamp']", 'object_name': 'Click'},
+ 'banner': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'clicks'", 'to': "orm['feincms_banners.Banner']"}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'ip': ('django.db.models.fields.IPAddressField', [], {'max_length': '15', 'null': 'True', 'blank': 'True'}),
+ 'referrer': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'}),
+ 'timestamp': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'user_agent': ('django.db.models.fields.TextField', [], {'default': "''", 'blank': 'True'})
+ },
+ 'medialibrary.category': {
+ 'Meta': {'ordering': "['parent__title', 'title']", 'object_name': 'Category'},
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['medialibrary.Category']"}),
+ 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '150'}),
+ 'title': ('django.db.models.fields.CharField', [], {'max_length': '200'})
+ },
+ 'medialibrary.mediafile': {
+ 'Meta': {'ordering': "['-created']", 'object_name': 'MediaFile'},
+ 'categories': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['medialibrary.Category']", 'null': 'True', 'blank': 'True'}),
+ 'copyright': ('django.db.models.fields.CharField', [], {'max_length': '200', 'blank': 'True'}),
+ 'created': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
+ 'file': ('django.db.models.fields.files.FileField', [], {'max_length': '255'}),
+ 'file_size': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
+ 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
+ 'type': ('django.db.models.fields.CharField', [], {'max_length': '12'})
+ }
+ }
+
+ complete_apps = ['feincms_banners']

0 comments on commit 15c86ea

Please sign in to comment.