question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Autocomplete Django Models

See original GitHub issue

In the following code I am not getting the auto complete suggestions for all of Model.Objects. When I use Pycharm it shows the auto complete, So I am not sure why I don’t see it with jedi-vim. Here is an example image of pycharm on top and vim on bottom. http://i.imgur.com/pwWl7UK.png

from django.db import models class Apple(models.Model): name = models.CharField(max_length=30)

class Orange(models.Model): name = models.CharField(max_length=30)

def get_top_apple(self):
    #I want .objects to autocomplete
    return Apple.objects.first()

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

9reactions
sazarycommented, Sep 30, 2019

@gun1x guess which year it is 😁 😁 😁

8reactions
g00nixcommented, Jul 30, 2017

Hey Flavio,

I didn’t track this issue. It will probably get developed in the future, if there are enogh vim django devs.

If you really need this, think about helping the community and sponsoring jedi support for meta classes.

If this doesn’t get done till 2019, I will probably try to sponsor this, since by then I will have a big Django project and I would rather use vim than any other IDE.

Best Regards, gxgung

On Fri, Jul 28, 2017 at 9:37 PM, Flávio Juvenal da Silva Junior < notifications@github.com> wrote:

I know Jedi doesn’t support metaclasses, and Django use metaclasses to link managers and querysets. But how python manage.py shell (with ipython installed) can autocomplete queryset methods? [image: screen shot 2017-07-28 at 15 33 36] https://user-images.githubusercontent.com/397989/28731446-52e5c9ba-73aa-11e7-87b5-8e7fa20b2e0e.png

Does anyone know if Django somehow give hints to Jedi?

The regular usage only gives autocompletion only for manager methods:

In [13]: import jedi …: …: source = ‘’’ …: from django.contrib.auth.models import User …: …: user = User.objects.‘’’ …: …: script = jedi.Script(source, 4, 20) …: script.completions() …: Out[13]: [<Completion: create_superuser>, <Completion: create_user>, <Completion: get_by_natural_key>, <Completion: make_random_password>, <Completion: normalize_email>, <Completion: use_in_migrations>, <Completion: _create_user>]

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/davidhalter/jedi-vim/issues/298#issuecomment-318731069, or mute the thread https://github.com/notifications/unsubscribe-auth/AKkrdNcleLTNt1FtE3hG8psTVnldPiAuks5sSipegaJpZM4CVlqw .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tutorial - django-autocomplete-light 3.9.0rc1 documentation
When Django Autocomplete Light calls your function two arguments are passed in. The first is the django.jQuery object. This is done since your...
Read more >
how to create a autocomplete input field in a form using Django
autoComplete is the function called to perform the action and ... from .models import model def email_autocomplete(request): if request.
Read more >
Implement Search Autocomplete For Input Fields in Django
In this article we will learn how to fetch data from django models and give it feature like autocomplete. We will be using...
Read more >
Django Admin Autocomplete Field Search Customization
I have a need to customize autocomplete field on django admin. So basically, I filter out serial numbers. ... The actual search should...
Read more >
Implement Search Autocomplete For Input Fields in Django
Implement Search Autocomplete For Input Fields in Django · Step 1. Create Django Project · Step 2. Add files and Folder to the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found