Skip to content

Link model's target field collides with the cms.api.add_plugin target parameter #252

@fsbraun

Description

@fsbraun

The target field of the Link model probably should be renamed to link_target, or it cannot be used with the Django CMS' API:

def add_plugin(placeholder, plugin_type, language, position="last-child", target=None, **data):
    """
    Adds a plugin to a placeholder and returns it.

    :param placeholder: Placeholder to add the plugin to
    :type placeholder: :class:`cms.models.placeholdermodel.Placeholder` instance
    :param plugin_type: What type of plugin to add
    :type plugin_type: str or :class:`cms.plugin_base.CMSPluginBase` sub-class, must be a valid plugin
    :param str language: Language code for this plugin, must be in :setting:`django:LANGUAGES`
    :param str position: Position to add this plugin to the placeholder. Allowed positions are ``"last-child"``
                         (default), ``"first-child"``, ``"left"``, ``"right"``.
    :param target: Parent plugin. Must be plugin instance
    :param data: Data for the plugin type instance
    """

The alternative - renaming the add_plugin target parameter into parent is a breaking change and not desired for the API.

Thanks, @mrbazzan for pointing this out in django-cms/djangocms-transfer#43

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions