question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

New related_name triggering migrations for all plugins

See original GitHub issue

It appears that this commit changed how the related_name is calculated per CMSPlugin subclass. If I do ./manage.py makemigrations, it attempts to create migrations for any installed app which subclasses CMSPlugin:

$ ./manage.py makemigrations
Migrations for 'cmsplugin_filer_image':
  0009_auto_20160719_0239.py:
    - Alter field cmsplugin_ptr on filerimage
Migrations for 'cmsplugin_filer_file':
  0005_auto_20160719_0239.py:
    - Alter field cmsplugin_ptr on filerfile
Migrations for 'djangocms_inherit':
  0003_auto_20160719_0239.py:
    - Alter field cmsplugin_ptr on inheritpageplaceholder
Migrations for 'cmsplugin_filer_teaser':
  0003_auto_20160719_0239.py:
    - Alter field cmsplugin_ptr on filerteaser
Migrations for 'cmsplugin_filer_folder':
  0003_auto_20160719_0239.py:
    - Alter field cmsplugin_ptr on filerfolder

As far as I can tell, the only thing these migrations do is add the related_name attribute to the cmsplugin_ptr field.

I didn’t see any warning about this in the documentation and I don’t see bugs or recent migrations added to other projects (cmsplugin_filer_*, etc.) so my first suspicion is that I’ve goofed something up or am generally suffering from lack of sleep. Apologies if so!

If this is a legitimate bug, this seems to mean that every external plugin app needs to have a new migration added and possibly will need to have point releases that are pinned to django-cms>=3.3.1. I haven’t tested, but if these migrations are added to a plugin app that is then run on django-cms<3.3.1, won’t migrations detect the lack of a related_name attribute and want to create a migration to remove it?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
czpythoncommented, Nov 29, 2016

Closing as this has now been addressed in all major addons.

0reactions
ericamadorcommented, Sep 8, 2016

@czpython

So far we think the best approach is to create the migration for apps that support 3.3.0 and up meaning Django 1.8+ (cmsplugin-filer is an example). For apps that still support Django 1.6 and 1.7, we’re planning to either drop 1.6 & 1.7 support or simply add the parent link field explicitly to the plugin model and specify the old related_name.

Since this was introduced in the 3.3.1 release, shouldn’t there a note in the changelog for v3.3.1 that mentions that this is to be expected? My organization maintains about 10 different CMS plugins, and to see that a new migration must be made for all of them because of what might appear at first glance to be a (semver) patch release was a little jarring. At first, I thought this was a problem with our configuration because there was no note of this in the changelog.

Read more comments on GitHub >

github_iconTop Results From Across the Web

New related_name triggering migrations for all plugins #5550
1. I haven't tested, but if these migrations are added to a plugin app that is then run on django-cms<3.3.1, won't migrations detect...
Read more >
How to create Plugins — django cms 3.10.0 documentation
Every plugin model inherits the empty cms.models.pluginmodel. ... The events will be triggered once after all scripts are successfully injected into the DOM ......
Read more >
Does changing a django models related_name attribute ...
The related_name attribute exists already, but I'd like to change it. Will this change require a migration of any kind?
Read more >
What is the best way to handle Events that get triggered during ...
One method we've thought of is to just programmatically set the Email plugin to disabled before running our migration. That might work for...
Read more >
Chaining Migrations using migration_lookup - Drupal
MigrationLookup ( migration_lookup ) is a migration process plugin that gets a value from a previous migration. It is particularly useful ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found