On Thu, 2006-08-10 at 13:24 -0700, Tomas Jacobsen wrote:
> Hi. Im pulling my hair out trying to make this url. I have seem some
[...]
> 
> My urls looks like this now:
> 
> 
> info_dict = {
>     'queryset': Project.objects.all(),
> }
> 
> urlpatterns = patterns('',
> 
>       #Portfolio
>       (r'^portfolio/$', 'django.views.generic.list_detail.object_list',
> dict(info_dict, template_name="portfolio/all_projects_list.html")),
>       (r'^portfolio/(?P<category_slug>[-\w]+)/$',
> 'myproject.portfolio.views.category_view'),
>       (r'^portfolio/(?P<category_slug>[-\w]+)/(?P<project_slug>[-\w]+)$',
> 'myproject.portfolio.views.category_view', dict(info_dict,
> template_name="portfolio/detail_view.html")),

Since the first part of the URL mapping tuple is a Python regular
expression, you can experiment at the command line. Import the "re"
module and use the regular expression you are trying to get working to
match against the sorts of URLs you are going to be sending in.
Something like:

        >>> import re
        >>> p = 
re.compile(r'^portfolio/(?P<category_slug>[-\w]+)/(?P<project_slug>[-\w]+)$')
        >>> s = 'portfolio/foo/blah/'
        >>> m = p.match(s)
        
At this point, m will either be None (it did not match) or a reg-exp
match object (see the Python docs for the re module for details) that
you can poke about at to see what made it into various keyword
arguments, etc.

The fact that you are seeing a 404 means that the regular expression is
not picking up your URLs, so you need to start there.

Regards,
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to