12.4.2012 11:51, David kirjoitti:
Hi Jani

That was very helpful. Is there a way to include select_related into
that query? or do I have to list every single field I would like to
return using values()?

last_deleted = ModificationLog.objects.values('thing__id', ' thing
__prefix', ' thing __first_name', ' thing__last_name', '
thing__company_name', 'thing__creator', ' thing __created_on',
'modifier').annotate(deletion_date=Max('modified_on')).filter(appointment__deleted=1).order_by('-deletion_date')[:20]

This for example works, but I don't have access to User. Thing contains
a FK to the User model, but I'm unable to do in the template {{
object_list.creator.get_full_name }}

But I am a lot lot closer than I was before, thank you.

--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/XRx3bOc68p0J.
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.

I suppose that you have to add all fields. I suggest that you install django-command-extensions and IPython. Run ./manage.py shell_plus and start experimenting.

--

Jani Tiainen



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