Hi!

I have a dilema.

I have two models, one is a user (a custom one, not the one from
django.contrib.auth), the other one is story model.

Since users are able to vote on stories, i also have a vote model, that has
two foreign keys (user, story) and also some metadata for the vote (date,
type of vote, ...).

When a user is logged in, i would like to be able to get the users vote for
the story, or stories on a story-list view.

One way of doing it would be to use template tags, but that would amount to
redundant SQL queries for each story. I guess another way of doing it would
be to write custom SQL using JOIN.

What I would like to know is what is the django way of doing this?

Any insight is appreciated.

Cheers,
Mitja

 
-- 
View this message in context: 
http://www.nabble.com/Releated-data-from-models-tf4359235.html#a12423642
Sent from the django-users mailing list archive at Nabble.com.


--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to