tolomea/django-auto-prefetch

base_manager_name check fails since 1.5.1

Opened this issue · 3 comments

Python Version

3.11

Django Version

4.1.7

Package Version

1.5.1

Description

Since 1.5.1 i get a warning like this for all my models using django-auto-prefetch:

vote.Question: (auto_prefetch.E001) Question inherits from auto_prefetch.Model but its base_manager_name is not 'prefetch_manager'
	HINT: The base_manager_name is instead None. Check the Meta class inherits from auto_prefetch.Model.Meta.

@benedikt-bartscher Could you share a simple example that recreates the problem? Thanks!

@benedikt-bartscher set it explicitly:

class MyModel(...):
    class Meta:
        base_manager_name = 'prefetch_manager'

The check exists because without the meta option set, auto-prefetching won't be performed for related manager querysets.

I've opened #236 to tweak the message from this check.