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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:04:08+00:00 2026-05-13T12:04:08+00:00

I have a base class A . Two derived classes B , C. Now

  • 0

I have a base class A . Two derived classes B , C.
Now I have a global class witch contains a many-to-many relation to object A.

Class D:
    aObjects : ManyToMany("A")

how could know the real object the filter query return in object D.
I mean : d.objects.get(id=5)
now d has n objects of class A, but they are a mix of A,B or C.
How can get only those of type B in the query.

Thanks in advance.

  • 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-13T12:04:09+00:00Added an answer on May 13, 2026 at 12:04 pm

    There’s no way to do this automatically. The documentation is quite clear that there’s no way to tell from an instance of a base class whether or not it should ‘actually’ be an instance of a derived class.

    The only thing to do is to define a field on the base class that shows what derived type it is, and set this automatically in the the save() method of the various derived classes. Then you can filter on the value of this field.

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

Sidebar

Ask A Question

Stats

  • Questions 501k
  • Answers 501k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I use Windows Server 2008 with SQL Server 2008 and… May 16, 2026 at 2:18 pm
  • Editorial Team
    Editorial Team added an answer It looks like you don't have an ID on your… May 16, 2026 at 2:18 pm
  • Editorial Team
    Editorial Team added an answer Well, in your class file you have the following: namespace… May 16, 2026 at 2:18 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have two classes: a base class, Foo::Base and a derived class, Foo::Base::Sub .
I have two objects that are derived from same the base class. Lets say
I have an abstract base class which acts as an interface. I have two
I'm learning C# and I encountered the following problem. I have two classes: base
I have two classes, point and pixel: class point { public: point(int x, int
Let's say I have the following two classes: public class Person { public string
Consider the following example. I have an interface MyInterface, and then two abstract classes
I want to Constraint that the Derived Class must have a Default Constructor. I
Why can't Java classes have abstract fields like they can with abstract methods? For
I have a class Wizard which creates a wizard with pages defined in the

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.