7 ms·
I gave ‘django-stubs’ a spin on a Django 2.2 project. The ORM typings and mypy plug-in worked great. ‘.filter().first()’ and similar all returned the correct ty
by emptysea 7y ago
I gave ‘django-stubs’ a spin on a Django 2.2 project. The ORM typings and mypy plug-in worked great. ‘.filter().first()’ and similar all returned the correct types.
Ran into a couple issues with the typing of ‘client.force_login()’ where the ‘user’ parameter was typed as the ‘get_django_user()’ which wasn’t the same as the custom user model I defined in the ‘models.py’. I also had issues with ‘from django.conf import settings’ not being the correct type so I’d suggest changing that to ‘Any’.
You might be able to override the few types that don’t work for your given setup or you can just fork the repo.
Overall, I think the pain is worth the benefits.
- mkurnikov 7y agoHi, I'm a primary maintainer of 'django-stubs'. We're going to release new version with mypy==0.750 and Django 3.0 support soon. Could you create an issue for your 'client.force_login' problem? > I also had issues with ‘from django.conf import settings’ not being the correct type so I’d suggest changing that to ‘Any’. This one also has plugin support, and should be working mostly correct. Fill the issue if you can reproduce, I'd love to help with that. What's your experience with that whole "plugin has to actually run django.setup() before typecheck" thing?