I stand corrected.  However, I should've been more explicit.  I
created a method that combines multiple fields on the Author model.
For example:

def Author(models.Model):
 first_name = models.CharField()
 last_name = models.CharField()

 def get_full_name(self):
   return self.first_name + ' ' + self.last_name

I've tried to access "author__get_full_name" but have not been
successful.

On Jun 29, 10:46 am, Karen Tracey <kmtra...@gmail.com> wrote:
> On Mon, Jun 29, 2009 at 10:27 AM, huu...@gmail.com <huu...@gmail.com> wrote:
>
> > I'd like to use values_list() to populate a choices attribute.
> > However, I need to access some foreign-keyed properties to properly
> > display the information.
>
> > For example:
>
> > >> Books.objects.values_list('id', 'author__name')
>
> > Currently, it doesn't appear to be working.
>
> It works for me:
>
> Python 2.5.2 (r252:60911, Oct  5 2008, 19:24:49)
> [GCC 4.3.2] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> (InteractiveConsole)>>> from crossword.models import Puzzles
> >>> Puzzles.objects.values_list('date', 'publisher__editor')[22]
>
> (datetime.date(2009, 6, 24), u'Rich Norris/Joyce Nichols Lewis')
>
> What do you get?  What were you expecting instead?
>
> Karen
--~--~---------~--~----~------------~-------~--~----~
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