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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T05:31:13+00:00 2026-06-02T05:31:13+00:00

For example, I want to get a list of User s. My current queryset

  • 0

For example, I want to get a list of Users. My current queryset looks like this

creator_list = User.objects.filter(
    Q(userprofile__place__managers=user) |
    Q(pk=user.pk)
)

I found out I could get the same result with ...managers=user.pk

creator_list = User.objects.filter(
    Q(userprofile__place__managers=user.pk) |
    Q(pk=user.pk)
)

I used to write ...=user.pk all the time until I realized I can simply drop the pk part. So in the second Q() clause, is it possible to remove the pk part as well? Thus I want to make it look like

creator_list = User.objects.filter(
    Q(userprofile__place__managers=user) |
    Q(something=user)
)

I understand that pk takes in the primary key, which is an integer, of the model, but why do I need to specify it when I already know that I want the filter through the User model.

  • 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-02T05:31:14+00:00Added an answer on June 2, 2026 at 5:31 am

    Unfortunately no. A field is required for field lookups, therefore the PK must be used since there is no way to refer specifically to the row indicated by a model.

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

Sidebar

Related Questions

If I want to get a user that has the email address of 'me@example.com',
This is a similar question to How can i get list of Domain user's
I have a list of user ids and want to get a few random
I want to get the single digits from two digits.for example if 36 I
I want to get N random numbers whose sum is a value. For example,
How can i mark menuitem in Application Bar. I want to get, for example,
I only want a simple Splash Screen Example. Get the Code, Insert my picture,
for example qa_sharutils-2009-04-22-15-20-39 , want chop last 20 bytes, and get ' qa_sharutils '.
how can I get the current playing list that is playing by music +
A list is created dynamically. Now I want to get 93 or 94 etc

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.