I think I may have a similar problem. Once I've imported my models
into the shell the following does exactly what I want it to:
In [10]: from django.shortcuts import get_object_or_404
In [11]: written=get_object_or_404(Writer, slug__iexact='joe-bloggs')
In [12]: queryset=Entry.live.filter(writer=written)
In [13]: queryset
Out[13]: [<Entry: Eggs>, <Entry: Spam>, <Entry: Bar>, <Entry: foo>]
But the view I'm using, which is almost identical, returns empty in
the {% for item in stories %} part of my template:
def writer_stories(request, writer):
# Look up the writer (and raise a 404 if it can't be found).
written=get_object_or_404(Writer, slug__iexact=writer)
return list_detail.object_list(
request,
queryset=Entry.live.filter(writer=written),
template_name='newssite/writer_archive.html',
template_object_name='stories',
I must admit I just don't know enough yet to tell whether this is the
same problem as the OP is having - if not please let me know and I'll
re-post as a new topic.
Kind regards
GJCGJC
On 11 Mar, 22:00, Andy McKay <[email protected]> wrote:
> > Does anybody have any clue what the problem might be? Thanks for your help!
>
> There should be no difference really between the two. What might help us if
> you show us the code that the runs from the shell and the code in the view.
> --
> Andy McKay, @clearwind
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
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.