How does Django offer code completion for Query.filter method?

Viewed 13

If I have a Django model like:

class Example(models.Model):
    is_in_stackoverflow = models.BooleanField()

and I try to filter said model like:

Example.objects.filter(is_in_stackoverflow=True)

My IDE (Pycharm to be specific) knows to offer me other kwargs based on the fields I specific for my model (for this case it might offer me is_in_stackoverlow__in or is_in_stackoverlow__isnull)

I would like to replicate this functionality in a library I am writing. I tried looking into the django source code but was unable to figure this magic out.

1 Answers

As helpfully mentioned by Willem Van Onsem, This is done by Pycharm's Django plugin.

Related