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 7771049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:33:10+00:00 2026-06-01T16:33:10+00:00

I have two models, say, Question and Topic . I am trying to add

  • 0

I have two models, say, Question and Topic.

I am trying to add methods to the Question model’s custom manager, e.g. some method that filters by Topic.

I can’t seem to use the other manager’s code for this (cannot import Topic either, so I can’t do Topic.objects...)

In class QuestionManager

def my_feed(self, user):
       topics = TopicManager().filter(user=user) # 1st approach
       #topics = Topic.objects.filter(user=user) # 2nd line
       # do something with topics

class TopicManager
….

Using 1st approach, I get the following error:

virtualenv/local/lib/python2.7/site-packages/django/db/models/sql/query.pyc in get_meta(self)
    219         by subclasses.
    220         """
--> 221         return self.model._meta
    222 
    223     def clone(self, klass=None, memo=None, **kwargs):

AttributeError: 'NoneType' object has no attribute '_meta'

I can’t use the 2nd line since I can’t import Topic, since Topic depends on the TopicManager in this file. Is there a workaround for this?

  • 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-06-01T16:33:11+00:00Added an answer on June 1, 2026 at 4:33 pm

    You can’t use a manager directly, in any circumstance. You always access it via the model class.

    If you can’t import the model at the top of the file because of a circular dependency, you can simply import it inside the method.

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

Sidebar

Related Questions

Say that I have two models- Users and Accounts. Each account can have at
So let's say I have two :has_and_belongs_to_many models that are joined by a simple
I have two models that are associated. I have an Artist model and a
I have two models lets say: class superfields(Model): fieldA = models.FloatField() fieldB = models.FloatField()
Got a question. Say I have two models in a many-to-many relationship (Article, Publication).
Let's say I have two models, Classes and People. A Class might have one
I have two models, say Product and Bundle. products table is related to product_prices
Say I have two models and one belongs to another. Now normaly you would
Let's say I have two simple models project t.string :title vote t.references :project t.integer
I have set up a Core Data model where I have two objects, say

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.