Sorry to reply to myself so quickly.

After a bit of refactoring my two views look like this:

def entries_by_category(request, slug):

        category = get_object_or_404(Category, slug=slug)
        entry_list_by_category = category.entry_set.order_by('-pub_date',
'title')
        return render_to_response('cake/entries_by_category.html',
{'entry_list_by_category': entry_list_by_category, 'category':
category})

def entries_by_child_category(request, slug, childslug):

        category = get_object_or_404(Category, slug=childslug)
        entry_list_by_category = category.entry_set.order_by('-pub_date',
'title')
        return render_to_response('cake/entries_by_category.html',
{'entry_list_by_category': entry_list_by_category, 'category':
category})

With the urlpatterns:

        (r'^category/(?P<slug>[-\w]+)/(?P<childslug>[-\w]+)',
'entries_by_child_category'),
        (r'^category/(?P<slug>[-\w]+)', 'entries_by_category'),

I'm sure there must be a way of doing this with just the one view
though.


--~--~---------~--~----~------------~-------~--~----~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to