Completion examples

This page shows completion menus produced by django-lsp against the checked-in Django project fixture. Every menu is generated by opening the example source through the real JSON-RPC service and requesting completion at its hidden <cursor> marker.

The menu order is the order returned to the editor. Long menus show the first entries and the number of additional results.

Model fields

Completion can begin from a partial field name anywhere inside a supported query call.

from .models import Blog
Blog.objects.filter(
ti
)
  • title
  • title__exact
  • title__iexact
  • title__icontains
  • title__contains

10 more results

Field lookups

After a scalar field and Django's __ separator, the server offers lookup expressions matching the typed prefix.

from .models import Blog
Blog.objects.filter(
title__
)
  • title__exact
  • title__iexact
  • title__icontains
  • title__contains
  • title__startswith

9 more results

Forward relations

Relations can be traversed without importing or executing the Django project.

from .models import Blog
Blog.objects.filter(
author__te
)
  • author__team
  • author__team__name
  • author__team__author
  • author__team__exact
  • author__team__in

18 more results

Deep relation paths

Completion continues across multiple related models.

from .models import Blog
Blog.objects.filter(
author__team__na
)
  • author__team__name
  • author__team__name__exact
  • author__team__name__iexact
  • author__team__name__icontains
  • author__team__name__contains

10 more results

Many-to-many relations

Many-to-many fields expose the related model's fields and lookup paths.

from .models import Blog
Blog.objects.filter(
tags__na
)
  • tags__name
  • tags__name__exact
  • tags__name__iexact
  • tags__name__icontains
  • tags__name__contains

10 more results

Reverse relations

Explicit reverse query names are indexed alongside forward relations.

from .models import Author
Author.objects.filter(
authored_blogs__ti
)
  • authored_blogs__title
  • authored_blogs__title__exact
  • authored_blogs__title__iexact
  • authored_blogs__title__icontains
  • authored_blogs__title__contains

10 more results

String arguments to select_related() only offer single-valued relationships. Completion follows foreign keys and one-to-one fields across multiple models, while excluding scalar and many-to-many fields.

from .models import Blog
Blog.objects.select_related(
"author__te"
)
  • author__team

prefetch_related() offers every relationship type. Reverse relationships use their Python accessor names, which can differ from the query names used by filter().

from .models import Author
Author.objects.prefetch_related(
"blogs__ta"
)
  • blogs__tags

Custom user model relations

Relations declared through settings.AUTH_USER_MODEL resolve to the configured user model.

from .models import Route
Route.objects.filter(
installer__time
)
  • installer__timezone
  • installer__timezone__exact
  • installer__timezone__iexact
  • installer__timezone__icontains
  • installer__timezone__contains

10 more results