To clarify, I would like to take the current url form of:

/dept_id/page_id/ (which looks like /2/13/)

into a url that looks like this:
/accounting/policy_for_travel_expenses/ (which puts the title of the
element in place of the element ID)

I am getting at the elements by ID this way:
    (r'^(?P<unit_id>\d+)/$', 'project.app.views.unit_index'),
    (r'^(?P<unit_id>\d+)/(?P<page_id>\d+)/$',
'project.app.views.unit_page'),

I am not sure how *[\w\d\-]+* would fit into my url configuration, I
am still learning the very basics.


On Jul 7, 9:54 am, Daniel Lathrop <[email protected]> wrote:
> I'm not quite clear on what you're asking, but if the issue is how to write
> a regex for slugs: The regular expression you need for slugs is *[\w\d\-]+*
>
> Hope that helps.
>
> Daniel
> ---------------------------
> Daniel Lathrop
>
> On Wed, Jul 7, 2010 at 9:32 AM, Rodion Raskolnikiv <[email protected]>wrote:
>
>
>
> > Greetings!
> > I am trying to implement a very simple (yet elegant) solution for a
> > university departmental website in django. In designing my urls, I
> > desired to have them follow this pattern:
> >    university.edu/department/page_title_made_into_slug
>
> > However, I couldn't get it working or find any doc that pointed out
> > how to do it, so I temporarily settled for:
> >    univeristy.edu/1/14 (where 1 is the department ID and 14 is the
> > page ID)
>
> > This is how I have my URLs set up right now:
> >    (r'^$', project.app.views.index'),
> >    (r'^(?P<unit_id>\d+)/$', 'project.app.views.unit_page'),
>
> > I have not actually set the pages to display yet, I thought that I
> > would ask here before I did that ...
>
> > Could anyone direct me to a solution so that I could have my URLs the
> > way that I want them?
>
> > --
> > 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]<django-users%2bunsubscr...@google 
> > groups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.

-- 
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.

Reply via email to