You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thank you for maintaining this library! I think I have found a bug in DJ12. Let's say I'm declaring multiple managers like in the docs:
# First, define the Manager subclass.
class DahlBookManager(models.Manager):
def get_queryset(self):
return super().get_queryset().filter(author="Roald Dahl")
# Then hook it into the Book model explicitly.
class Book(models.Model):
title = models.CharField(max_length=100)
author = models.CharField(max_length=50)
objects = models.Manager() # The default manager.
dahl_objects = DahlBookManager() # The Dahl-specific manager.
flake8-django will flag dahl_objects, I believe because DJ12.is_manager_declaration assumes that managers are only named objects.
Thank you for maintaining this library! I think I have found a bug in DJ12. Let's say I'm declaring multiple managers like in the docs:
flake8-django will flag
dahl_objects
, I believe becauseDJ12.is_manager_declaration
assumes that managers are only namedobjects
.The issue I believe is that Django's docs state that the order of managers is important, i.e., the first manager defined is always the default manager: https://docs.djangoproject.com/en/5.0/topics/db/managers/#default-managers
The text was updated successfully, but these errors were encountered: