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

feat: Added support for django-cms 4.x #201

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ Changelog
Unreleased
==========

* Added support for django-cms 4.0
* Display page title instead of menu title


Expand Down
9 changes: 8 additions & 1 deletion djangocms_link/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@ def for_site(self, site):
# current site
# this will work for PageSelectFormField
from cms.models import Page
self.fields['internal_link'].queryset = Page.objects.drafts().on_site(site)

# django-cms 3.x compatibility
try:
self.fields['internal_link'].queryset = Page.objects.drafts().on_site(site)
# django-cms 4.x compatibility
except AttributeError:
self.fields['internal_link'].queryset = Page.objects.on_site(site)

# set the current site as a internal_link field instance attribute
# this will be used by the field later to properly set up the queryset
# this will work for PageSearchField
Expand Down