I'm looking at the documentation here:

http://docs.djangoproject.com/en/dev/ref/templates/builtins/#regroup

And am looking for the best practices way to deal with doing that from
within the manager.  This seems like a common issue:

1. I have two models, one foreign keys to the other (comments ->
bookmarks)
2. I want, for each bookmark, to list each comment_description.

This would be the dictionary (or I could use a queryset, or a list, or
ideally a dictionary of lists, or whatever is considered best
practice)

[{'comment_id': 1, 'bookmark_id': 1, 'comment_description':
u'Bookmark1 Description'}, {'comment_id': 2, 'bookmark_id': 1,
'comment_description': u'Bookmark1 Another Description'}, {'id': 3,
'comment_id': 2, 'comment_description': u'Bookmark2 Description'}]

I want:

bookmark_id 1, comment_descriptions "Bookmark1 Description","Bookmark1
Another Description"
bookmark_id 2, comment_descriptions "Bookmark2 Description"

The Python docs are really tough to navigate and while the Django docs
are excellent, I can't find the standard solution for this.  I know it
must come up all the time (as it would with PHP).

Thanks,
Adam

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to