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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T02:07:44+00:00 2026-06-02T02:07:44+00:00

I have problem with model built like this: class Topping(models.Model): name = models.CharField(max_length=30) class

  • 0

I have problem with model built like this:

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

class Pizza(models.Model):
    cook = models.ForeignKey(Cook)
    name = models.CharField(max_length=50)
    toppings = models.ManyToManyField(Topping)

I’m trying to select all toppings used by provided cook on his pizzas.

on SQL I could use select * from Toppings t where t.id IN(select topping_id from Pizzas where cook_id = ?) or some other way (surely more efficient 😛 ). Problem is I’m bound to use django models, because of underlying dependencies, like paging.

Because it’s database used by many applications it would be great if it could be done without changing models…

  • 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-02T02:07:46+00:00Added an answer on June 2, 2026 at 2:07 am
    Topping.objects.filter(pizza__cook=mycook)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following models: class Product(models.Model): active = models.BooleanField(default=True) name = models.CharField(max_length=40, unique=True)
I have an interesting problem with hibernate, the model looks like the following: @NamedQueries({
This is my problem, I have a tiny PHP MVC framework i built. Now
I have seen this problem arise in many different circumstances and would like to
I've got a basic Item model in my Django app: class Item(models.Model): name =
I've built a multi-select form (from within form_for) like this: <div class=rounded-block quarter-wide radio-group>
I have a comment model that posts under a micropost like facebook. The problem
I have problem with keeping my model (represented as List) in sync with a
I have a problem adding ADO.Net Entity Data Model to my existing project, or
I have a problem when I try to persist my model. An exception is

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.