djangocms-blog
djangocms-blog copied to clipboard
When removing a blog post i get cannot call delete() after .distinct().
I cannot remove a blog post. I get "Cannot call delete() after .distinct()."
Steps to reproduce
djangocms_blog==1.2.3 django==3.2.5
Apparently this repo is not ready for django 3.2.5.. When i switch back to django==1.2.9 it does work..
Seeing the same here
# admin deletion fix
from djangocms_blog.admin import PostAdmin
def new_get_queryset_admin(self, request):
qs = super(PostAdmin, self).get_queryset(request)
sites = self.get_restricted_sites(request)
if sites.exists():
pks = list(sites.all().values_list("pk", flat=True))
qs = qs.filter(sites__in=pks)
return qs #.distinct() DJ32 fix
PostAdmin.get_queryset = new_get_queryset_admin
@svandeneertwegh if still relevant, I am using the above monkey-patch to get deletion working again in the list view. Not seeing any other side-effects with my simple setup.
Perhaps @yakky will know more - is the distinct
actually required? (present here: https://github.com/nephila/djangocms-blog/blob/develop/djangocms_blog/admin.py#L439)
I do not seem to be observing any ill-effects after our monkey-patch.
For me the same issue was fixed via setting
Django = ">=3.2,<3.3"
in pyproject.toml, so it selected itself Django 3.2.13.
The bug is still present for me with djangocms-blog==1.2.3
and Django==3.2.13
.
any solution? django bug?
any solution? django bug?
I would not call it a bug, it is more of a behaviour change that we need to adapt to.
Thanks for reporting this, it's fixed in #735