Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6335117
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:47:38+00:00 2026-05-24T18:47:38+00:00

I have been using ActiveState Komodo for a while and while most of the

  • 0

I have been using ActiveState Komodo for a while and while most of the code-completion is spot on it lacks the code completion from Django’s model manager.

I have included the Django directory in my PYTHONPATH and get most of the code completion, the notable exception being the models.

Assuming I have a model users I would expect the code users.objects. to show autocomplete options such as all(),count(),filter() etc. however these are added by the model’s manager which does so in a seemingly abnormal way.

I am wondering if I can ‘force’ Komodo to pick up the models.

The model manager looks to be included from the following code (taken from manager.py)

def ensure_default_manager(sender, **kwargs):
"""
Ensures that a Model subclass contains a default manager  and sets the
_default_manager attribute on the class. Also sets up the _base_manager
points to a plain Manager instance (which could be the same as
_default_manager if it's not a subclass of Manager).
"""
cls = sender
if cls._meta.abstract:
    return
if not getattr(cls, '_default_manager', None):
    # Create the default manager, if needed.
    try:
        cls._meta.get_field('objects')
        raise ValueError("Model %s must specify a custom Manager, because it has a field named 'objects'" % cls.__name__)
    except FieldDoesNotExist:
        pass
    cls.add_to_class('objects', Manager())
    cls._base_manager = cls.objects
...

Specifically the last two lines. Is there any way to tell Komodo that <model>.objects = Manager() so the proper code completion is shown?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T18:47:38+00:00Added an answer on May 24, 2026 at 6:47 pm

    Probably the easiest way to get this to work seems to be to add the following to the top of models.py:

    from django.db.models import manager
    

    and then under each model add

    objects = manager.Manager()
    

    so that, for example, the following:

    class Site(models.Model):
        name = models.CharField(max_length=200)
        prefix = models.CharField(max_length=1)
        secret = models.CharField(max_length=255)
    
        def __unicode__(self):
            return self.name
    

    becomes

    class Site(models.Model):
        name = models.CharField(max_length=200)
        prefix = models.CharField(max_length=1)
        secret = models.CharField(max_length=255)
    
        objects = manager.Manager()
    
        def __unicode__(self):
            return self.name
    

    This is how you would (explicitly) set your own model manager, and by explicitly setting the model manager (to the default) Kommodo picks up the code completion perfectly.

    Hopefully this will help someone 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have been using CruiseControl for quite a while with NUnit and NAnt. For
I have been using C# for a while now, and going back to C++
I have been using Ruby for a while now and I find, for bigger
I have been using IoC for a little while now and I am curious
I have been using this script for a while and suddenly it just stopped
I have been using jQuery for a while. I wanted to use the parent()
I have been using Javassist to dynamically manipulate classes as they are loaded. While
I have been using the following code for loading JQuery in all of my
I have been using form inheritance for a while now but without doing much
We have been using MongoDB as our main datastore for a little while but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.