Okay, here's where I've got so far. My problem with this is that, as will be immediately apparent, There's an awful lot being repeated here:
from django.conf.urls.defaults import * from newssite.models import Entry, Category def story_archive(request, cat): # Look up the category (and raise a 404 if it can't be found). category = get_object_or_404(Category, slug__iexact=cat) # Use the object_list view for the heavy lifting. return date_based.archive_index( request, queryset = Entry.live.filter(navigation_parent=category), date_field = 'pub_date' template_name = 'newssite/story_archive.html', template_object_name = 'latest_stories', extra_context = {...} ) def stories_archive_year(request, cat, year): # Look up the category (and raise a 404 if it can't be found). category = get_object_or_404(Category, slug__iexact=cat) # Use the object_list view for the heavy lifting. return date_based.archive_year( request, queryset = Entry.live.filter(navigation_parent=category), date_field = 'pub_date' year, template_name = 'newssite/story_archive_year.html', template_object_name = 'story', extra_context = {...} ) def stories_archive_month(request, cat, year, month): # Look up the category (and raise a 404 if it can't be found). category = get_object_or_404(Category, slug__iexact=cat) # Use the object_list view for the heavy lifting. return date_based.archive_month( request, queryset = Entry.live.filter(navigation_parent=category), date_field = 'pub_date' year, month, template_name = 'newssite/story_archive_month.html', template_object_name = 'story', extra_context = {...} ) def stories_archive_day(request, cat, year, month, day): # Look up the category (and raise a 404 if it can't be found). category = get_object_or_404(Category, slug__iexact=cat) # Use the object_list view for the heavy lifting. return date_based.archive_year( request, queryset = Entry.live.filter(navigation_parent=category), date_field = 'pub_date' year, month, day, template_name = 'newssite/story_archive_day.html', template_object_name = 'story', extra_context = {...} ) def story_detail(request, cat, year, month, day, slug): # Look up the category (and raise a 404 if it can't be found). category = get_object_or_404(Category, slug__iexact=cat) # Use the object_list view for the heavy lifting. return date_based.object_detail( request, queryset = Entry.live.filter(navigation_parent=category), date_field = 'pub_date' year, month, day, slug, template_name = 'newssite/story_archive_day.html', template_object_name = 'story', extra_context = {...} ) Is there an accepted way to make this more DRY that I'm missing? Thanks -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.