huu...@gmail.com wrote:
> 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.
The values_list method takes field names that are actually database
model fields. `get_full_name` is not a DB field. So you can't use it
directly in the values list. But you can get the first_name and
last_name fields and post process them to generate the full_name in
Python.
-RD
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---