I’m trying to build this query
select * from m_orders where year(order_date) = '2010'
the field order_date is a DateTime field. I just don’t want to use raw sql queries here. Is it even possible to use e.g. MySQL functions in django quersets?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
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.
You can achieve this without using raw SQL. Use the built in
__mechanism instead (see the documentation for more details). Something like this: