Hi guys,

I'm trying to get a better grip on Django design philosophy, and I'm a
little confused as to why calls to a manager's " values() " function
returns foreign keys as the value of their primary key rather than as
django objects.  For example:

class Author (models.Model) :
  name = CharField(maxlength=100)
class Story (models.Model) :
  author = ForeignKey(Author)

"Story.objects.values('author').distinct()" returns a set of
dictionaries whose values are Author.id 's instead of the actual Author
objects.  I then have to Author.objects.get(id) for each id, which
seems like the sort of boilerplate code Django usually avoids.

Am I missing a better way of doing this, or a reason it *should* work
this way?

Thanks,
G


--~--~---------~--~----~------------~-------~--~----~
 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