Re: Autosuggest / code completion

Todd Whiteman <[email protected]> Thu, 25 Apr 2013 09:41:45 -0700
Newsgroups gmane.comp.ide.komodo.general
Message-ID <[email protected]>
On 13-04-25 05:38 AM, Nico den Boer wrote:
> In my Django project I have defined one model (Task) which is a subclass of django.db.models
> In the code it is first instantiated like
> task = Task()
> As soon as I type task. Komodo starts to scan packages.
> Then I see an error:
> "evaluating 'task' at tasks.py#502. Could not resolve 'objects' getattr on <class Task> in (blob 'models', []) (error determining completions)
>
> There is no problem with the built-in models or any other classes in Django.
> Komodo can also find functions in my project. Only the models which are defined cannot be found.

Hi Nico,

I assume the code can run successfully (i.e. that all of these Django 
modules are correctly installed) and "python manage.py runserver" works 
correctly?

In my tests, I'm not seeing any problems getting completions for Django 
models (django.models.Model, django.models.CharField, etc...), nor any 
problems with classes that subclass these models, e.g.:

   from django.db import models
   class Product(models.Model):
       name = models.CharField(maxlength=50, unique=True)
   p = Product()
   p.  # I successfully see the completions in this case.

One thing to check is that the Django files being used are the ones you 
expect - you can perform a goto definition on "models.Model" to find 
where it's located.

Perhaps you could send me the files/project in question so we can 
further check for any problems.

> Looking around to what is causing this, it looks like Komodo requires a Django model to have an 'objects' property with an instantion of a models.Manager.
> Is this true? If so, is there any way to get around that (apart from modifying existing code)?

Komodo doesn't require anything specific with Python/Django classes and 
modules, it just requires valid Python code in which to scan/parse.

Cheers,
Todd

_______________________________________________
Komodo-discuss mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/Komodo-discuss