On Fri, 2006-08-11 at 04:47 -0700, Tomas Jacobsen wrote: > Yes, I was missing the last slash. Now I get the detail page, but now I > get the real problem I thought I had at first for this page. Because I > use the category_slug in my url for the detail page, I don't think I > can use generic view for this page?
If you want to use generic views you *have* to use only the parameters described in the documentation for generic views, that's right. So as soon as you want highly customised URLs like you are trying to create here, you have left behind the ability to use purely generic views. But that's okay. They're just an aid, not a requirement. > Don't I need a "custom" view that get the 'category_slug' and > 'project_slug' ? Yes. > If I try this in my views.py: > > def detail_view(request, project_slug): > queryset = Project.objects.filter(project_slug = project_slug) > context = {'project_slug': project_slug} > return object_detail(request, queryset, extra_context = > context) > > I get: > > TypeError at /portfolio/web/web_project/ > detail_view() got an unexpected keyword argument 'category_slug' That error should be self-explanatory. The function only accepts a project_slug parameter (along with the obligatory request parameter). The view functions are standard Python functions: you need to tell them what parameters to expect. > Is there an easy way to just drop the 'category_slug' the detail_view, > or is it another/better way to do this? If you want a view that works with category_slug, just add another parameter to the function call and work with it inside the function. If you want a view that works with both (just project_slug or project_slug + category_slug), then make the function definition look like: def detail_view(request, project_slug, category_slug = None): ... and inside the function take different actions depending upon whether category_slug is None or not. Malcolm --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---