Skip to content

Django does not guarentee that all Model children has a .objects manager. #8432

Description

@g1rly-c0d3r

Since django no longer guarentees that Model class children have a default manager field named "objects", several type annotations are no longer possible, see 69b35c7.
This makes for code that is harder to reason about, and more error-prone.

# TODO: Use this everywhere
class ModelWithTable(models.Model):
specify_model: Table
class Meta:
abstract = True

ModelWithTable (see above) is a class that once #8052 is merged, will explicitly state the objects manager.
Using this as the base class for our models instead of django.db.models.Model would allow us to re-apply these type annotations.

This change would also allow more unity between our code and django, since a model would carry it's associated table, rather than having two separate instances floating around.

Additional context
Found using mypy type checking during #8052

Metadata

Metadata

Assignees

Labels

1 - EnhancementImprovements or extensions to existing behavior

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions