logoalt Hacker News

mr_Fatalysttoday at 8:44 AM1 replyview on HN

You can't call filter() without a model. It's always Folder.objects.filter(user_id=user_id), so the context is right there in the code. Plus the generated .pyi stubs give your IDE full type info per model, so "go to usages" works through the type system.


Replies

murkttoday at 12:00 PM

When it’s a simple single-line query: sure.

When they’re 30 lines apart, because it’s a function that builds a complex query with joins and filters based on some function arguments: not easy.

I don’t really understand how .pyi will give me proper Find usages here. I haven’t used them a lot, though, and just rely on pycharm Find Usages or just rg.

Also, what about foreign keys? Let’s say it’s a filter on user__email__startswith. Are you able to find it when executing Find Usages on User.email field?

show 1 reply