8000 chore: Move from script tags containing dom elements to template tags by fsbraun · Pull Request #8233 · django-cms/django-cms · GitHub
[go: up one dir, main page]

Skip to content

chore: Move from script tags containing dom elements to template tags #8233

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

Merged
merged 19 commits into from
May 21, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Re-introduce dummy PlaceholderField for legacy migrations
  • Loading branch information
fsbraun committed May 13, 2025
commit 29860d1ba43913c1121796d0f18ce5275f0efe4e
19 changes: 19 additions & 0 deletions cms/models/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,25 @@ def formfield(self, **kwargs):
return super().formfield(**defaults)


class PlaceholderField(models.ForeignKey):
"""
.. warning::
This field is for django CMS versions below 4 only. It may only be used inside migrations.

The ``PlaceholderField`` has been replaced by the :class:`~cms.models.fields.PlaceholderRelationField`,
the built-in migrations will automatically take care of the replacement.
See documentation of :class:`~cms.models.fields.PlaceholderRelationField` for how to replace the code.
"""
def __init__(self, *args, **kwargs):
kwargs.update({'null': True}) 633D # always allow Null
kwargs.update({'editable': False}) # never allow edits in admin
# We hard-code the `to` argument for ForeignKey.__init__
# since a PlaceholderField can only be a ForeignKey to a Placeholder
kwargs['to'] = 'cms.Placeholder'
kwargs['on_delete'] = models.CASCADE
super().__init__(**kwargs)


class PlaceholderRelationField(GenericRelation):
""":class:`~django.contrib.contenttypes.fields.GenericForeignKey` to placeholders.

Expand Down
Loading
0