I've posted this
<http://stackoverflow.com/questions/32555097/django-advanced-annotate>
issue on Stackoverflow
Given this model:
from django.db import models
class Post(models.Model):
text = models.CharField(max_length=255)
class Comment(models.Model):
text = models.CharField(max_length=255)
needs_attention = models.BooleanField(default=False)
created_at = models.DateTimeField(auto_now_add=True)
post = models.ForeignKey(Post)
I can annotate the list of posts with:
Post.objects.annotate(last_comment_date=Max('comment__created_at'))
to know the last_comment_date, how to annotate to set a value for
last_comment_needs_attention?
How can obtain details from the last comment when listing ll posts?
Thanks!
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/767682ba-7b96-464e-b2b2-b0ff82fbd320%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.