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
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.
specify7/specifyweb/specify/models.py
Lines 28 to 32 in 9ae5e2b
ModelWithTable(see above) is a class that once #8052 is merged, will explicitly state theobjectsmanager.Using this as the base class for our models instead of
django.db.models.Modelwould 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