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

  • SEARCH
  • Home
  • 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 8560255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T16:14:08+00:00 2026-06-11T16:14:08+00:00

I am making a new section on a website where existing customers ( Customer

  • 0

I am making a new section on a website where existing customers (Customer model) can choose to appear on.
New users are not required to have an account from the main site (Customer) and can just create an account for the new section (NewSecUser model)

class Customer(models.Model):
    name = models.CharField(max_length=50)
    #[...]
    is_visible_on_new_section = models.BooleanField(default=False)

class NewSecUser(model.Model):
    name = models.CharField(max_length=50)
    #[...]
    customer_id = models.IntegerField(null=True)
    # customer_id refers to the id of a Customer model object 
    # its value is different from null only when a Customer chooses to appear
    # on the new section

How would one use exclude() to filter-out NewSecUser objects where Customer objects have an id equal to NewSecUser.customer_id and is_visible_on_new_section set to False?

Basically something similar to an SQL JOIN (with new_sec_user.customer_id=customer.id) I believe.

I know it would have been much easier with customer_id being a foreign key but I did not choose 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-11T16:14:09+00:00Added an answer on June 11, 2026 at 4:14 pm
    Customer.filter(id__in = [nsu.pk for nsu in NewSecUser.all()]).filter(is_visible_on_new_selection=True).all()`
    

    or something very similar

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

Sidebar

Related Questions

I am making a new application in MongoDB, and I have found that the
I'm making a new Mac OS X application. (not an iPhone app) This is
This can be done by making a new HTTP handler, but is there a
I am currently building an making my new website. It uses one page and
I've been tasked with making our help section open in a new window which
On my website I have a section with announcements and now I'm working at
I have a donations section on my website and I'm interested whether the following
I am developing requirements for a new website design for my company. I have
I am new to xcode and making my first iPhone app. I have a
Making a new site but something is happening to it in IE8. The social

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.