Sunday, April 3, 2011

Re: Odd problem with queryset

At the suggestion of someone on IRC, I tried accessing the first result from within my template, using {{ thread.original_author.0 }} (where original_author is the name of the function with the return statement), and that works fine.

It's a workaround, but not ideal, as I'll be using it in various places throughout the project, and if I need to change it, that'd mean going through each bit of code manually (defeating the point of me writing the function in the first place).

Exactly the same problem applies when I access the posts using self.post_set.order_by('created)[0]

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment