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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:56:59+00:00 2026-05-20T20:56:59+00:00

Up until a couple days ago I have been using the following query succesfully.

  • 0

Up until a couple days ago I have been using the following query succesfully. The following query has always returned the data it was supposed to return:

try:
  totals = MyObject.objects.get(date=report_date)
except MyObject.DoesNotExist:
  return HttpResponse('Could not find totals from %s' % (report_date))

A couple days ago this query began returning an empty QuerySet, even though data Does exist for the day I am requesting.

I am getting the date from report_date = date.today().strftime('%Y-%m-%d')
or from a form

if request.method == 'POST':
  form = DateForm(request.POST)
  if form.is_valid:
    report_date = request.POST['date']

The Model is simple datefield()

class MyObject(models.Model):
  """Total numbers for a specific day"""
  date = models.DateField()
  ... remaining fields ...

I have verified through the shell that there is in fact data for todays date in TotalTransactions. I have been using this code for months with no problem. I made a work around yesterday by querying
totals = MyObject.objects.get(date__gte=report_date, date__lte=report_date)
but this morning it no longer worked!! This morning I then tried the original query of date=report_date and that worked!

So my question is: Has anyone had this problem before?? Can anyone see something in my code that i am missing? Any suggestions on more workarounds? I appreciate your time.

  • 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-20T20:56:59+00:00Added an answer on May 20, 2026 at 8:56 pm

    why converting to the string? you do not have a control on how date is converted, eg. locale issues.

    switch to date objects and set in views only:

    report_date = date.today()
    

    and get data from the form’s cleaned_data dict:

    report_date = form.cleaned_data['date']
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been working with Java a couple of years, but up until recently
I have been running an MSDEPLOY command successfully for the past couple weeks until
I have been tearing my hair out over the last couple of days. Just
I've been using SubSonic (ActiveRecord) for a couple of years. I've been waiting until
Until recently I have been using cairngorm as a framework for flex. However, in
$j(.context-menu).livequery(function(){ alert('found'); }); This was working until a couple of days ago. It just
I have been playing around with GTK since a couple of days now,while going
Until now I've been used to using DAOs to retrieve information from databases. Other
I've been playing with Corona for a couple of days and everything was going
Until now, I have always said that CakePHP is too bloated and slow. I

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.