diff --git a/CHANGELOG.rst b/CHANGELOG.rst index f8cc1776..9513e805 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -1,4 +1,12 @@ +---------- +XXXX-XX-XX +---------- + +Version 1.7 + +* Move migrations to standard location + ---------- 2015-06-09 ---------- diff --git a/README.rst b/README.rst index 9893a61b..3194443b 100644 --- a/README.rst +++ b/README.rst @@ -21,16 +21,19 @@ Installation This plugin requires :code:`django CMS` 3.0 or higher to be properly installed and configured. If you have many pages it supports ajax loading for selecting a page. -To enable this install Django-Select2 3.1.2 or above. +To enable this install Django-Select2 3.4 or above. * In your projects :code:`virtualenv`, run :code:`pip install djangocms-link`. * Add :code:`djangocms_link'` to your :code:`INSTALLED_APPS` setting. -* If using Django 1.7 add :code:`'djangocms_link': 'djangocms_link.migrations_django',` - to :code:`MIGRATION_MODULES` (or define `:code:`MIGRATION_MODULES`` if it does not exists); - when django CMS 3.1 will be released, migrations for Django 1.7 will be moved - to the standard location and the south-style ones to :code:`south_migrations`. * Run ``manage.py migrate djangocms_link``. +.. warning:: If upgrading for versions prior to 1.7, remove `djangocms_link` from + ``MIGRATION_MODULES`` setting. + +.. warning:: If using Django 1.6, you may need to eventually add + :code:`'djangocms_link': 'djangocms_link.south_migrations',` to + :code:`SOUTH_MIGRATION_MODULES` + If you want to enable the ajax loading: * In your projects :code:`virtualenv`, run :code:`pip install Django-Select2`. diff --git a/djangocms_link/migrations/0001_initial.py b/djangocms_link/migrations/0001_initial.py index 24d18255..c9b4edd9 100644 --- a/djangocms_link/migrations/0001_initial.py +++ b/djangocms_link/migrations/0001_initial.py @@ -1,104 +1,32 @@ # -*- coding: utf-8 -*- -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models, connection - - -class Migration(SchemaMigration): - - def forwards(self, orm): - table_names = connection.introspection.table_names() - if 'cmsplugin_link' in table_names: - db.rename_table('cmsplugin_link', 'djangocms_link_link') - elif 'link_link' in table_names: - db.rename_table('link_link', 'djangocms_link_link') - else: - # Adding model 'Link' - db.create_table(u'djangocms_link_link', ( - (u'cmsplugin_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['cms.CMSPlugin'], unique=True, primary_key=True)), - ('name', self.gf('django.db.models.fields.CharField')(max_length=256)), - ('url', self.gf('django.db.models.fields.URLField')(max_length=200, null=True, blank=True)), - ('page_link', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['cms.Page'], null=True, blank=True)), - ('mailto', self.gf('django.db.models.fields.EmailField')(max_length=75, null=True, blank=True)), - ('target', self.gf('django.db.models.fields.CharField')(max_length=100, blank=True)), - )) - db.send_create_signal(u'djangocms_link', ['Link']) - - - def backwards(self, orm): - # Deleting model 'Link' - db.delete_table(u'djangocms_link_link') - - - models = { - 'cms.cmsplugin': { - 'Meta': {'object_name': 'CMSPlugin'}, - 'changed_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'creation_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'language': ('django.db.models.fields.CharField', [], {'max_length': '15', 'db_index': 'True'}), - 'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), - 'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.CMSPlugin']", 'null': 'True', 'blank': 'True'}), - 'placeholder': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.Placeholder']", 'null': 'True'}), - 'plugin_type': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}), - 'position': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True', 'blank': 'True'}), - 'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), - 'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}) - }, - 'cms.page': { - 'Meta': {'ordering': "('tree_id', 'lft')", 'unique_together': "(('publisher_is_draft', 'application_namespace'),)", 'object_name': 'Page'}, - 'application_namespace': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), - 'application_urls': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '200', 'null': 'True', 'blank': 'True'}), - 'changed_by': ('django.db.models.fields.CharField', [], {'max_length': '70'}), - 'changed_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), - 'created_by': ('django.db.models.fields.CharField', [], {'max_length': '70'}), - 'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'in_navigation': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}), - 'is_home': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}), - 'languages': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), - 'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), - 'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), - 'limit_visibility_in_menu': ('django.db.models.fields.SmallIntegerField', [], {'default': 'None', 'null': 'True', 'db_index': 'True', 'blank': 'True'}), - 'login_required': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'navigation_extenders': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '80', 'null': 'True', 'blank': 'True'}), - 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['cms.Page']"}), - 'placeholders': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['cms.Placeholder']", 'symmetrical': 'False'}), - 'publication_date': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), - 'publication_end_date': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), - 'publisher_is_draft': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}), - 'publisher_public': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'publisher_draft'", 'unique': 'True', 'null': 'True', 'to': "orm['cms.Page']"}), - 'reverse_id': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '40', 'null': 'True', 'blank': 'True'}), - 'revision_id': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), - 'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), - 'site': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'djangocms_pages'", 'to': u"orm['sites.Site']"}), - 'soft_root': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}), - 'template': ('django.db.models.fields.CharField', [], {'default': "'INHERIT'", 'max_length': '100'}), - 'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}) - }, - 'cms.placeholder': { - 'Meta': {'object_name': 'Placeholder'}, - 'default_width': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'slot': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}) - }, - u'djangocms_link.link': { - 'Meta': {'object_name': 'Link', '_ormbases': ['cms.CMSPlugin']}, - u'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}), - 'mailto': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '256'}), - 'page_link': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.Page']", 'null': 'True', 'blank': 'True'}), - 'target': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}), - 'url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}) - }, - u'sites.site': { - 'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"}, - 'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - } - } - - complete_apps = ['djangocms_link'] \ No newline at end of file +from __future__ import unicode_literals + +from django.db import models, migrations +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('cms', '__first__'), + ] + + operations = [ + migrations.CreateModel( + name='Link', + fields=[ + ('cmsplugin_ptr', models.OneToOneField(serialize=False, parent_link=True, auto_created=True, to='cms.CMSPlugin', primary_key=True)), + ('name', models.CharField(verbose_name='name', max_length=256)), + ('url', models.URLField(verbose_name='link', blank=True, null=True)), + ('anchor', models.CharField(help_text='This applies only to page and text links.', blank=True, default='', max_length=128, verbose_name='anchor')), + ('mailto', models.EmailField(help_text='An email address has priority over a text link.', blank=True, null=True, max_length=75, verbose_name='mailto')), + ('phone', models.CharField(help_text='A phone number has priority over a mailto link.', blank=True, null=True, max_length=40, verbose_name='Phone')), + ('target', models.CharField(verbose_name='target', blank=True, max_length=100, choices=[('', 'same window'), ('_blank', 'new window'), ('_parent', 'parent window'), ('_top', 'topmost frame')])), + ('page_link', models.ForeignKey(help_text='A link to a page has priority over a text link.', on_delete=django.db.models.deletion.SET_NULL, blank=True, verbose_name='page', to='cms.Page', null=True)), + ], + options={ + 'abstract': False, + }, + bases=('cms.cmsplugin',), + ), + ] diff --git a/djangocms_link/migrations_django/0002_auto_20140929_1705.py b/djangocms_link/migrations/0002_auto_20140929_1705.py similarity index 100% rename from djangocms_link/migrations_django/0002_auto_20140929_1705.py rename to djangocms_link/migrations/0002_auto_20140929_1705.py diff --git a/djangocms_link/migrations_django/0003_auto_20150212_1310.py b/djangocms_link/migrations/0003_auto_20150212_1310.py similarity index 100% rename from djangocms_link/migrations_django/0003_auto_20150212_1310.py rename to djangocms_link/migrations/0003_auto_20150212_1310.py diff --git a/djangocms_link/migrations_django/0004_auto_20150708_1133.py b/djangocms_link/migrations/0004_auto_20150708_1133.py similarity index 100% rename from djangocms_link/migrations_django/0004_auto_20150708_1133.py rename to djangocms_link/migrations/0004_auto_20150708_1133.py diff --git a/djangocms_link/migrations_django/0001_initial.py b/djangocms_link/migrations_django/0001_initial.py deleted file mode 100644 index c9b4edd9..00000000 --- a/djangocms_link/migrations_django/0001_initial.py +++ /dev/null @@ -1,32 +0,0 @@ -# -*- coding: utf-8 -*- -from __future__ import unicode_literals - -from django.db import models, migrations -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('cms', '__first__'), - ] - - operations = [ - migrations.CreateModel( - name='Link', - fields=[ - ('cmsplugin_ptr', models.OneToOneField(serialize=False, parent_link=True, auto_created=True, to='cms.CMSPlugin', primary_key=True)), - ('name', models.CharField(verbose_name='name', max_length=256)), - ('url', models.URLField(verbose_name='link', blank=True, null=True)), - ('anchor', models.CharField(help_text='This applies only to page and text links.', blank=True, default='', max_length=128, verbose_name='anchor')), - ('mailto', models.EmailField(help_text='An email address has priority over a text link.', blank=True, null=True, max_length=75, verbose_name='mailto')), - ('phone', models.CharField(help_text='A phone number has priority over a mailto link.', blank=True, null=True, max_length=40, verbose_name='Phone')), - ('target', models.CharField(verbose_name='target', blank=True, max_length=100, choices=[('', 'same window'), ('_blank', 'new window'), ('_parent', 'parent window'), ('_top', 'topmost frame')])), - ('page_link', models.ForeignKey(help_text='A link to a page has priority over a text link.', on_delete=django.db.models.deletion.SET_NULL, blank=True, verbose_name='page', to='cms.Page', null=True)), - ], - options={ - 'abstract': False, - }, - bases=('cms.cmsplugin',), - ), - ] diff --git a/djangocms_link/south_migrations/0001_initial.py b/djangocms_link/south_migrations/0001_initial.py new file mode 100644 index 00000000..24d18255 --- /dev/null +++ b/djangocms_link/south_migrations/0001_initial.py @@ -0,0 +1,104 @@ +# -*- coding: utf-8 -*- +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models, connection + + +class Migration(SchemaMigration): + + def forwards(self, orm): + table_names = connection.introspection.table_names() + if 'cmsplugin_link' in table_names: + db.rename_table('cmsplugin_link', 'djangocms_link_link') + elif 'link_link' in table_names: + db.rename_table('link_link', 'djangocms_link_link') + else: + # Adding model 'Link' + db.create_table(u'djangocms_link_link', ( + (u'cmsplugin_ptr', self.gf('django.db.models.fields.related.OneToOneField')(to=orm['cms.CMSPlugin'], unique=True, primary_key=True)), + ('name', self.gf('django.db.models.fields.CharField')(max_length=256)), + ('url', self.gf('django.db.models.fields.URLField')(max_length=200, null=True, blank=True)), + ('page_link', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['cms.Page'], null=True, blank=True)), + ('mailto', self.gf('django.db.models.fields.EmailField')(max_length=75, null=True, blank=True)), + ('target', self.gf('django.db.models.fields.CharField')(max_length=100, blank=True)), + )) + db.send_create_signal(u'djangocms_link', ['Link']) + + + def backwards(self, orm): + # Deleting model 'Link' + db.delete_table(u'djangocms_link_link') + + + models = { + 'cms.cmsplugin': { + 'Meta': {'object_name': 'CMSPlugin'}, + 'changed_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), + 'creation_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'language': ('django.db.models.fields.CharField', [], {'max_length': '15', 'db_index': 'True'}), + 'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), + 'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), + 'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.CMSPlugin']", 'null': 'True', 'blank': 'True'}), + 'placeholder': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.Placeholder']", 'null': 'True'}), + 'plugin_type': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}), + 'position': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True', 'blank': 'True'}), + 'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), + 'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}) + }, + 'cms.page': { + 'Meta': {'ordering': "('tree_id', 'lft')", 'unique_together': "(('publisher_is_draft', 'application_namespace'),)", 'object_name': 'Page'}, + 'application_namespace': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'application_urls': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '200', 'null': 'True', 'blank': 'True'}), + 'changed_by': ('django.db.models.fields.CharField', [], {'max_length': '70'}), + 'changed_date': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'blank': 'True'}), + 'created_by': ('django.db.models.fields.CharField', [], {'max_length': '70'}), + 'creation_date': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'in_navigation': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}), + 'is_home': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}), + 'languages': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), + 'level': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), + 'lft': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), + 'limit_visibility_in_menu': ('django.db.models.fields.SmallIntegerField', [], {'default': 'None', 'null': 'True', 'db_index': 'True', 'blank': 'True'}), + 'login_required': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + 'navigation_extenders': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '80', 'null': 'True', 'blank': 'True'}), + 'parent': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'children'", 'null': 'True', 'to': "orm['cms.Page']"}), + 'placeholders': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['cms.Placeholder']", 'symmetrical': 'False'}), + 'publication_date': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'publication_end_date': ('django.db.models.fields.DateTimeField', [], {'db_index': 'True', 'null': 'True', 'blank': 'True'}), + 'publisher_is_draft': ('django.db.models.fields.BooleanField', [], {'default': 'True', 'db_index': 'True'}), + 'publisher_public': ('django.db.models.fields.related.OneToOneField', [], {'related_name': "'publisher_draft'", 'unique': 'True', 'null': 'True', 'to': "orm['cms.Page']"}), + 'reverse_id': ('django.db.models.fields.CharField', [], {'db_index': 'True', 'max_length': '40', 'null': 'True', 'blank': 'True'}), + 'revision_id': ('django.db.models.fields.PositiveIntegerField', [], {'default': '0'}), + 'rght': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}), + 'site': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'djangocms_pages'", 'to': u"orm['sites.Site']"}), + 'soft_root': ('django.db.models.fields.BooleanField', [], {'default': 'False', 'db_index': 'True'}), + 'template': ('django.db.models.fields.CharField', [], {'default': "'INHERIT'", 'max_length': '100'}), + 'tree_id': ('django.db.models.fields.PositiveIntegerField', [], {'db_index': 'True'}) + }, + 'cms.placeholder': { + 'Meta': {'object_name': 'Placeholder'}, + 'default_width': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'slot': ('django.db.models.fields.CharField', [], {'max_length': '50', 'db_index': 'True'}) + }, + u'djangocms_link.link': { + 'Meta': {'object_name': 'Link', '_ormbases': ['cms.CMSPlugin']}, + u'cmsplugin_ptr': ('django.db.models.fields.related.OneToOneField', [], {'to': "orm['cms.CMSPlugin']", 'unique': 'True', 'primary_key': 'True'}), + 'mailto': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'null': 'True', 'blank': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '256'}), + 'page_link': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['cms.Page']", 'null': 'True', 'blank': 'True'}), + 'target': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}), + 'url': ('django.db.models.fields.URLField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}) + }, + u'sites.site': { + 'Meta': {'ordering': "('domain',)", 'object_name': 'Site', 'db_table': "'django_site'"}, + 'domain': ('django.db.models.fields.CharField', [], {'max_length': '100'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) + } + } + + complete_apps = ['djangocms_link'] \ No newline at end of file diff --git a/djangocms_link/migrations/0002_auto__add_field_link_phone.py b/djangocms_link/south_migrations/0002_auto__add_field_link_phone.py similarity index 100% rename from djangocms_link/migrations/0002_auto__add_field_link_phone.py rename to djangocms_link/south_migrations/0002_auto__add_field_link_phone.py diff --git a/djangocms_link/migrations/0003_auto__add_field_link_anchor__chg_field_link_page_link.py b/djangocms_link/south_migrations/0003_auto__add_field_link_anchor__chg_field_link_page_link.py similarity index 100% rename from djangocms_link/migrations/0003_auto__add_field_link_anchor__chg_field_link_page_link.py rename to djangocms_link/south_migrations/0003_auto__add_field_link_anchor__chg_field_link_page_link.py diff --git a/djangocms_link/migrations_django/__init__.py b/djangocms_link/south_migrations/__init__.py similarity index 100% rename from djangocms_link/migrations_django/__init__.py rename to djangocms_link/south_migrations/__init__.py diff --git a/setup.py b/setup.py index 59ecb2cd..0048b1f9 100644 --- a/setup.py +++ b/setup.py @@ -28,7 +28,7 @@ author='Divio AG', author_email='info@divio.ch', url='https://github.com/divio/djangocms-link', - packages=['djangocms_link', 'djangocms_link.migrations', 'djangocms_link.migrations_django'], + packages=['djangocms_link', 'djangocms_link.migrations', 'djangocms_link.south_migrations'], install_requires=['django-select2>=4.3'], license='LICENSE.txt', platforms=['OS Independent'],