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 BlogBlog.objects.filter( ti)Field lookups
After a scalar field and Django's __ separator, the server offers lookup expressions matching the
typed prefix.
from .models import BlogBlog.objects.filter( title__)Forward relations
Relations can be traversed without importing or executing the Django project.
from .models import BlogBlog.objects.filter( author__te)Deep relation paths
Completion continues across multiple related models.
from .models import BlogBlog.objects.filter( author__team__na)Many-to-many relations
Many-to-many fields expose the related model's fields and lookup paths.
from .models import BlogBlog.objects.filter( tags__na)Reverse relations
Explicit reverse query names are indexed alongside forward relations.
from .models import AuthorAuthor.objects.filter( authored_blogs__ti)Related-object loading
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 BlogBlog.objects.select_related( "author__te")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 AuthorAuthor.objects.prefetch_related( "blogs__ta")Custom user model relations
Relations declared through settings.AUTH_USER_MODEL resolve to the configured user model.
from .models import RouteRoute.objects.filter( installer__time)