I need to add key/value to queryset per each object based on stuff in request.session.
How to do that?
Alan
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.
Historical answer:
You can use the
.extra()method on a queryset to add extra ‘fields’.There is some documentation that may be useful.
New answer:
You should use the
.annotate()method to add extra fields.View the documentation.