djangocms-picture
djangocms-picture copied to clipboard
fix: added missing migrations
Description
Adding missing migrations for newer Django (couldn't find particular version, but migrations for OneToOneField are generated with a slight difference).
# older django - currently in migrations
field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, parent_link=True, related_name='djangocms_picture_picture', primary_key=True, serialize=False, to='cms.CMSPlugin'),
# new django v4.1 - in this PR
field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, related_name='%(app_label)s_%(class)s', serialize=False, to='cms.cmsplugin'),
Related resources
- https://github.com/django-cms/djangocms-picture/pull/118
- https://github.com/django-cms/djangocms-picture/issues/122
- the same migration in project django-cms/djangocms-file https://github.com/django-cms/djangocms-file/blob/master/djangocms_file/migrations/0012_alter_file_cmsplugin_ptr_alter_folder_cmsplugin_ptr.py
Checklist
- [x] I have opened this pull request against
master
- [ ] I have added or modified the tests when changing logic
- [ ] I have followed the conventional commits guidelines to add meaningful information into the changelog
- [x] I have read the contribution guidelines and I have joined #workgroup-pr-review on Slack to find a “pr review buddy” who is going to review my pull request.
this is a duplicate with #118 and actually I don't like the migration dependency being last cms migration from v4, that breaks backward compatibility
will try to improve this
Changed migration dependency to the first migration of CMS
newer Django treat migrations for OneToOneField with a slight difference (couldn't find particular version where this change occurs)
It seems sensible to update migrations to the newer standard.
# older django - currently in migrations
field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, parent_link=True, related_name='djangocms_picture_picture', primary_key=True, serialize=False, to='cms.CMSPlugin'),
# new django (tested in v4.1.8) - in this PR
field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, related_name='%(app_label)s_%(class)s', serialize=False, to='cms.cmsplugin'),
Changed migration dependency to the first migration of CMS
What is the reason for that?
Changed migration dependency to the first migration of CMS
What is the reason for that?
It seems to me, that it brings more independence in version of DjangoCMS as the latest migrations may not be present in older versions.
Thanks @marksweb and @fsbraun for the lesson :man_student:
Thanks @marksweb and @fsbraun for the lesson 👨🎓
Thanks for contributing. I went looking for this migration trick again and I think it's undocumented. Just one of those things you pick up from people that have found it from others I think.