Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to migrate LinkPlugin #31

Open
tschale opened this issue Apr 7, 2022 · 0 comments
Open

How to migrate LinkPlugin #31

tschale opened this issue Apr 7, 2022 · 0 comments

Comments

@tschale
Copy link
Member

tschale commented Apr 7, 2022

Only links from FilerLinkPlugin are migrated to FilerLink2Plugin. Link-instances can be migrated in the same way, but as the fieldnames differ, the links need to be specifically migrated (I only had external_links or internal_links), e.g.:

old_links = Link.objects.all()
for old_link in old_links:
    cmsplugin = CMSPlugin.objects.get(id=old_link.cmsplugin_ptr_id)
    Link.objects.filter(id=old_link.id).delete()
    
    link = FilerLink2Plugin(cmsplugin_ptr=cmsplugin)
    link.__dict__.update(old_link.__dict__)
    link.plugin_type = 'FilerLink2Plugin'
    if old_link.external_link:
        link.url = old_link.external_link
    if old_link.internal_link:
        link.page_link = old_link.internal_link
    link.save()
    link.parent.numchild += 1
    link.parent.save()
@tschale tschale changed the title LinkPlugin is not included in migration How to migrate LinkPlugin Apr 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant