fixes #4475: Split thema into separate fields.
[redakcja.git] / src / toolbar / migrations / 0001_initial.py
index 5a6f27c..184436d 100644 (file)
@@ -1,93 +1,68 @@
-# encoding: utf-8
-import datetime
-from south.db import db
-from south.v2 import SchemaMigration
-from django.db import models
+# This file is part of FNP-Redakcja, licensed under GNU Affero GPLv3 or later.
+# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
+#
+from django.db import models, migrations
 
 
-class Migration(SchemaMigration):
 
 
-    def forwards(self, orm):
+class Migration(migrations.Migration):
 
 
-        # Adding model 'ButtonGroup'
-        db.create_table('toolbar_buttongroup', (
-            ('position', self.gf('django.db.models.fields.IntegerField')(default=0)),
-            ('slug', self.gf('django.db.models.fields.SlugField')(max_length=50, db_index=True)),
-            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
-            ('name', self.gf('django.db.models.fields.CharField')(max_length=32)),
-        ))
-        db.send_create_signal('toolbar', ['ButtonGroup'])
+    dependencies = [
+    ]
 
 
-        # Adding model 'Button'
-        db.create_table('toolbar_button', (
-            ('key_mod', self.gf('django.db.models.fields.PositiveIntegerField')(default=1, blank=True)),
-            ('scriptlet', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['toolbar.Scriptlet'], null=True, blank=True)),
-            ('tooltip', self.gf('django.db.models.fields.CharField')(max_length=120, blank=True)),
-            ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
-            ('link', self.gf('django.db.models.fields.CharField')(default='', max_length=256, blank=True)),
-            ('key', self.gf('django.db.models.fields.CharField')(max_length=1, blank=True)),
-            ('params', self.gf('django.db.models.fields.TextField')(default='[]')),
-            ('label', self.gf('django.db.models.fields.CharField')(max_length=32)),
-            ('slug', self.gf('django.db.models.fields.SlugField')(unique=True, max_length=50, db_index=True)),
-        ))
-        db.send_create_signal('toolbar', ['Button'])
-
-        # Adding M2M table for field group on 'Button'
-        db.create_table('toolbar_button_group', (
-            ('id', models.AutoField(verbose_name='ID', primary_key=True, auto_created=True)),
-            ('button', models.ForeignKey(orm['toolbar.button'], null=False)),
-            ('buttongroup', models.ForeignKey(orm['toolbar.buttongroup'], null=False))
-        ))
-        db.create_unique('toolbar_button_group', ['button_id', 'buttongroup_id'])
-
-        # Adding model 'Scriptlet'
-        db.create_table('toolbar_scriptlet', (
-            ('code', self.gf('django.db.models.fields.TextField')()),
-            ('name', self.gf('django.db.models.fields.CharField')(max_length=64, primary_key=True)),
-        ))
-        db.send_create_signal('toolbar', ['Scriptlet'])
-
-
-    def backwards(self, orm):
-
-        # Deleting model 'ButtonGroup'
-        db.delete_table('toolbar_buttongroup')
-
-        # Deleting model 'Button'
-        db.delete_table('toolbar_button')
-
-        # Removing M2M table for field group on 'Button'
-        db.delete_table('toolbar_button_group')
-
-        # Deleting model 'Scriptlet'
-        db.delete_table('toolbar_scriptlet')
-
-
-    models = {
-        'toolbar.button': {
-            'Meta': {'object_name': 'Button'},
-            'group': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['toolbar.ButtonGroup']"}),
-            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'key': ('django.db.models.fields.CharField', [], {'max_length': '1', 'blank': 'True'}),
-            'key_mod': ('django.db.models.fields.PositiveIntegerField', [], {'default': '1', 'blank': 'True'}),
-            'label': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
-            'link': ('django.db.models.fields.CharField', [], {'default': "''", 'max_length': '256', 'blank': 'True'}),
-            'params': ('django.db.models.fields.TextField', [], {'default': "'[]'"}),
-            'scriptlet': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['toolbar.Scriptlet']", 'null': 'True', 'blank': 'True'}),
-            'slug': ('django.db.models.fields.SlugField', [], {'unique': 'True', 'max_length': '50', 'db_index': 'True'}),
-            'tooltip': ('django.db.models.fields.CharField', [], {'max_length': '120', 'blank': 'True'})
-        },
-        'toolbar.buttongroup': {
-            'Meta': {'object_name': 'ButtonGroup'},
-            'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
-            'name': ('django.db.models.fields.CharField', [], {'max_length': '32'}),
-            'position': ('django.db.models.fields.IntegerField', [], {'default': '0'}),
-            'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'db_index': 'True'})
-        },
-        'toolbar.scriptlet': {
-            'Meta': {'object_name': 'Scriptlet'},
-            'code': ('django.db.models.fields.TextField', [], {}),
-            'name': ('django.db.models.fields.CharField', [], {'max_length': '64', 'primary_key': 'True'})
-        }
-    }
-
-    complete_apps = ['toolbar']
+    operations = [
+        migrations.CreateModel(
+            name='Button',
+            fields=[
+                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+                ('label', models.CharField(max_length=32)),
+                ('slug', models.SlugField(unique=True)),
+                ('params', models.TextField(default=b'[]')),
+                ('link', models.CharField(default=b'', max_length=256, blank=True)),
+                ('accesskey', models.CharField(max_length=1, blank=True)),
+                ('tooltip', models.CharField(max_length=120, blank=True)),
+            ],
+            options={
+                'ordering': ('slug',),
+                'verbose_name': 'button',
+                'verbose_name_plural': 'buttons',
+            },
+            bases=(models.Model,),
+        ),
+        migrations.CreateModel(
+            name='ButtonGroup',
+            fields=[
+                ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
+                ('name', models.CharField(max_length=32)),
+                ('slug', models.SlugField()),
+                ('position', models.IntegerField(default=0)),
+            ],
+            options={
+                'ordering': ('position', 'name'),
+                'verbose_name': 'button group',
+                'verbose_name_plural': 'button groups',
+            },
+            bases=(models.Model,),
+        ),
+        migrations.CreateModel(
+            name='Scriptlet',
+            fields=[
+                ('name', models.CharField(max_length=64, serialize=False, primary_key=True)),
+                ('code', models.TextField()),
+            ],
+            options={
+            },
+            bases=(models.Model,),
+        ),
+        migrations.AddField(
+            model_name='button',
+            name='group',
+            field=models.ManyToManyField(to='toolbar.ButtonGroup'),
+            preserve_default=True,
+        ),
+        migrations.AddField(
+            model_name='button',
+            name='scriptlet',
+            field=models.ForeignKey(blank=True, to='toolbar.Scriptlet', null=True, on_delete=models.CASCADE),
+            preserve_default=True,
+        ),
+    ]