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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:40:21+00:00 2026-05-22T11:40:21+00:00

Hi I have a user input form which takes date in 2011-05-12 format. I

  • 0

Hi I have a user input form which takes date in 2011-05-12 format. I want to query the results using Q . But my database field is in datetime format something like 2011-05-18 08:36:34. I am giving the query like this

k = Posts.objects.filter(Q(review_email__contains = user), review_time = datetime(date)) where user is some username and date is the form inputvalue

If I execute the above query I am getting below error

Traceback (most recent call last):
File "<console>", line 1, in <module>
TypeError: 'module' object is not callable

Can some one help me in solving this. Thanks in advance

  • 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-22T11:40:22+00:00Added an answer on May 22, 2026 at 11:40 am

    The error comes from not doing datetime.datetime, but as soon you fix that, you’re going run into incorrect results in your query. When you coerce the datetime.date to a datetime.datetime object it will be at midnight. Consequently, only Posts created exactly at midnight on that day will match.

    You should do this instead:

    Post.objects.filter(
         review_email__contains = user, 
         review_time__year=date.year, 
         review_time__day=date.day, 
         review_time__month=date.month,
     )
    

    See the queryset reference for more info.

    On a side note, you don’t really need to use the Q object in this.

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

Sidebar

Related Questions

I have an ASP.NET form that takes input from a user. There's a Submit
On a website if I have a form where the user can input some
I have to make column charts in Excel using VBA only (no user input).
How can I validate the user input by using scanf. Right now I have
I have a situation where I have to take input from the user using
So I have an input form that I want to use to update a
I have an asp page which takes a bunch of input and posts to
I have an ASP.NET web application that takes user input across several forms. Sort
I have a JSP form which is made of <input type=file/> tag alone for
i have a input tag which is non editable, but some times i need

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.