Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jnothman/django-tabcomplete
IPython tab completion for Django DB models
https://github.com/jnothman/django-tabcomplete
Last synced: 26 days ago
JSON representation
IPython tab completion for Django DB models
- Host: GitHub
- URL: https://github.com/jnothman/django-tabcomplete
- Owner: jnothman
- License: other
- Created: 2015-07-14T14:50:41.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-09-07T02:41:10.000Z (over 9 years ago)
- Last Synced: 2024-10-28T22:02:12.883Z (2 months ago)
- Language: Python
- Size: 129 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rst
- License: COPYING
Awesome Lists containing this project
README
Django TabComplete
==================What?
-----Tab completion over Django model fields in IPython.
Example::
User.objects.filter(us
becomes::
User.objects.filter(username
and::
User.objects.filter(username__st
becomes::
User.objects.filter(username__startswith=
Related fields are also supported::
User.objects.filter(groups__permissions__name__startswith
How?
----Install it with `pip`::
$ pip install git+https://github.com/jnothman/django-tabcomplete
then add it to your Django project's ``settings.py``::
INSTALLED_APPS = [
...
'django_tabcomplete',
]Why?
----For users of the Django ORM who frequently construct custom queries in
interactive shells, it can be a challenge to remember field names on
inter-related models. For such situations was tab completion invented,
but while IPython provides tab completion for named function arguments,
this does not extend to dynamic keyword arguments (i.e. whose names are
not provided in the code or docstring).Limitations
-----------Currently tab completion is only supported on ``filter`` and ``exclude``
methods of ``Manager`` or ``QuerySet`` objects that are referred to by a
variable name or a sequence of attribute lookups. Thus no completion is
provided for::User.objects.all().filter(us
Nor can we currently provide tab completion in ``Q`` objects, though they can
perform the same function, or in aggregates to name fields, because the target
model cannot be identified locally.More?
-----We intend to add tab completion for other ``QuerySet`` methods that take
field names as keyword arguments or as positional strings.Pull requests are welcome!