question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Custom Page Manager from queryset not working

See original GitHub issue

I can’t make things work just using the sample code in the guide here

Please note there is an error in the sample code: there is a missing “()” at the end of this lineobjects = PageManager.from_queryset(EventPageQuerySet)

I initially had the problem while working with wagtail_modeltranslation (see more at infoportugal/wagtail-modeltranslation#95). I couldn’t find the problem, so I thought it may be not related to that thirdy-app. I finally restarted from zero with the sample, but I see I get this traceback:

Traceback (most recent call last):
    EventPage.objects.future()
  File "C:\xxxxxxxxxxx\Lib\site-packages\django\db\models\manager.py", line 127, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
AttributeError: 'PageQuerySet' object has no attribute 'future'
  • Python version: 2.7
  • Django version: 1.8.x
  • Wagtail version: 1.7

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
gasmancommented, Apr 20, 2017

I can confirm that the EventPageQuerySet example doesn’t currently work as written, because BasePageManager in wagtailcore.models has a hard-coded reference to PageQuerySet - I’ve now opened #3557 to fix this.

1reaction
thornycrackerscommented, Mar 28, 2017

I also ran into this problem and solved it by overriding the get_queryset function on a custom Manager.

Edit: Python3 Django 1.10 Wagtail 1.9

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using custom Manager & QuerySet does not work with related ...
The problem is when we try to use both custom Manager and custom Queryset ( objects = AttendanceLogManager() ), such as:
Read more >
Managers - Django documentation
The way Manager classes work is documented in Making queries; this document specifically touches on model options that customize Manager behavior.
Read more >
Custom Model Manager & Model QuerySet in Django - YouTube
In this video, I'm gonna be discussing about custom model manager and custom model queryset in Django. Model manager and queryset are a ......
Read more >
Working with QuerySets and managers | Django 3 By Example
QuerySets usually return another unevaluated QuerySet. You can concatenate as many filters as you like to a QuerySet, and you will not hit...
Read more >
Managers — Django v1.3.1 documentation
A Manager is the interface through which database query operations are provided to ... of a model object -- use Model methods, not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found