Hello
I have just started to learn Django.
I have setup a Blog model, and an Entry model. I would like to use a
generic view to list all of the entries in a given blog. The url to
this should be /blog-slug/.
I am unclear how I can bring up all of the entries for my blog, or
rather how I can pass "blog.slug" into the Entry.objects.all() so it
will pick up all the correct entries for referenced blog.
I think I should be using select_related, but I don't know how to pass
the blog.slug to it. So far I am just getting:
object_list() got an unexpected keyword argument 'slug'
My urls.py looks like this:
from django.conf.urls.defaults import *
from bandsite.blogs.models import Blog
from bandsite.blogs.models import Entry
entry_list = {
'queryset': Entry.objects.all(),
'template_object_name': 'entry',
}
urlpatterns = patterns('',
(r'^(?P<slug>[-\w]+)/$',
'django.views.generic.list_detail.object_list', entry_list),
)
Thank you for any help you can offer me.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---