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
This works fine if I don't inherit from SoftDeletableModel but if I do I get:
error: Need type annotation for "sub_items" [var-annotated]
error: Need type annotation for "model_a" [var-annotated]
error: Need type annotation for "deleted_model_a" [var-annotated]
@flaeppe Thanks for the reply! I get that this is more related to django-model-utils, but since you're probably more familiar with python (and Django) typing, could you maybe point me at what could cause the issue? It doesn't look like they're doing anything crazy, is it the Mixin that could be causing this?
I don't understand either, why this would happen. While django-model-utils is missing many specific type hints, it actually includes a py.typed marker. So mypy should be fully aware that SoftDeletableModel inherits from models.Model.
If you're looking for a quick work-around hack, this might help:
Uh oh!
There was an error while loading. Please reload this page.
Bug report
What's wrong
I'm using https://github.com/jazzband/django-model-utils/blob/master/model_utils/models.py#L133-L158 (I know this isn't a great implementation for soft deletion, but I needed something quick and simple) and have the following models set up:
This works fine if I don't inherit from
SoftDeletableModel
but if I do I get:System information
python:3.11.7-slim-bullseye
)python
version: 3.11.7django
version:django==4.2.7
mypy
version:mypy==1.7.0
django-stubs
version:django-stubs[compatible-mypy]==4.2.7
django-stubs-ext
version:django-stubs-ext==4.2.7
The text was updated successfully, but these errors were encountered: