Last active
August 29, 2015 14:20
-
-
Save driesdesmet/8d1eed9f7a64167a6bbd to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # -*- coding: utf-8 -*- | |
| from __future__ import unicode_literals | |
| from django.db import models, migrations | |
| from cms.models.pluginmodel import CMSPlugin | |
| def addconfig(apps, schema_editor): | |
| # Existing Quote Plugins don't have a configuration model, they use the default CMSPlugin, but now they should be | |
| # using RandomQuotePlugin which stores the amount of quotes to show. We add a default of 1, to make it backwards | |
| # compatible. | |
| RandomQuotePlugin = apps.get_model("cmsplugin_randomquote", "RandomQuotePlugin") | |
| for plugin in CMSPlugin.objects.filter(plugin_type="QuotePlugin"): | |
| randomquoteplugin = RandomQuotePlugin(cmsplugin_ptr=plugin) | |
| randomquoteplugin.save() | |
| class Migration(migrations.Migration): | |
| dependencies = [ | |
| ('cms', '0011_auto_20150419_1006'), | |
| ('cmsplugin_randomquote', '0002_randomquoteplugin'), | |
| ] | |
| operations = [ | |
| migrations.RunPython(addconfig), | |
| ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment