Skip to content

Commit

Permalink
Try again
Browse files Browse the repository at this point in the history
  • Loading branch information
fsbraun committed Oct 26, 2024
1 parent 0943e23 commit 3a6e214
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions djangocms_link/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
from cms.models import PageContent
else:
from cms.models import Title as PageContent
PageContent.admin_manager = PageContent.objects

class GrouperModelAdmin:
pass
Expand Down Expand Up @@ -122,9 +121,14 @@ def get_queryset(self):
qs = qs.filter(page__site_id=self.site)
except (AttributeError, FieldError):
# django CMS 3.11 - 4.1
qs = PageContent.admin_manager.filter(
language=self.language, title__icontains=self.term
).current_content().values_list("page_id", flat=True)
if hasattr(PageContent, "admin_manager"): # V4
qs = PageContent.admin_manager.filter(
language=self.language, title__icontains=self.term
).current_content().values_list("page_id", flat=True)
else: # V3
qs = PageContent.objects.filter(
language=self.language, title__icontains=self.term
).values_list("page_id", flat=True)
qs = Page.objects.filter(pk__in=qs).order_by("node__path")
if self.site:
qs = qs.filter(page__site_id=self.site)
Expand Down

0 comments on commit 3a6e214

Please sign in to comment.