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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:40:57+00:00 2026-05-24T19:40:57+00:00

I am setting up a simple billing system, where I have a table that

  • 0

I am setting up a simple billing system, where I have a table that lists users and the day they are supposed to be billed. Each user only has one row of this table associated with them.

I need to query the database on a daily basis to get a list of users to be billed on that day.

The model is:

class BillingDay(models.Model):
    user = models.ForeignKey(User)
    day = models.IntegerField(max_length=2)

How would I query against the day field? User.objects.filter(billingday=1) looks at the ID, but I’m looking i need to get a list of users with 1 as the value for day in billingday

  • 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-24T19:40:58+00:00Added an answer on May 24, 2026 at 7:40 pm
    User.objects.filter(billingday__day=1)
    

    Just as a note, though, you might want to rethink how you’re setting this up before you get too far down the rabbit hole. Will users have multiple billing days? My guess would be no. If that’s the case, there’s no reason for a BillingDay model. It only adds complexity and fragments data. The billing day could just be a field on your user profile.

    Now, creating a user profile for a User is in principle no different that having a BillingDay model as a way to add extra data to User, but it’s far more extensible. Django has builtin methods for having a user profile associate with every User, and you can more data to the same user profile object over time. Whereas, BillingDay would be relegated to just one data point and you’d later have to add additional models (more complexity and fragmentation of data) for other data points down the line.

    See Django’s documentation on user profiles.

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

Sidebar

Related Questions

I have a simple (not user-editable) numerical setting defined in a preferences XML as
I have simple issue setting a two-way databinding of a checkbox in Silverlight 3.0.
I'm setting up a simple page that just displays the contents of an XML
I am setting up a simple test page in Python. I only have two
How to implement scrolling animation? I'm ok with setting a simple AlphaAnimation that triggers
I am just looking at setting up a simple viewController programatically, I have a
I am setting up a simple routing system for my new custom MVC framework
I'm having difficulty setting up a simple menu that displays results on a div
I am trying to create a simple setting in Orchard that appears in the
I'm dealing with a LAMP web server. I have forms that users use to

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.