Re: Smarter URLs

2010-07-07 Thread Rodion Raskolnikiv
Many thanks to you both! That was enough info to get things working! On Jul 7, 11:36 am, ringemup wrote: > Add a SlugField to the Page model, and populate it based on the title > (this can be done automatically either via the admin's > prepopulated_fields, or via a custom model save() method) >

Re: Smarter URLs

2010-07-07 Thread ringemup
Add a SlugField to the Page model, and populate it based on the title (this can be done automatically either via the admin's prepopulated_fields, or via a custom model save() method) class Page(models.Model): title = models.CharField(max_length=50) slug = models.SlugField() Then use a reg

Re: Smarter URLs

2010-07-07 Thread Rodion Raskolnikiv
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

Re: Smarter URLs

2010-07-07 Thread Daniel Lathrop
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 wrote: > Greetings! > I

Smarter URLs

2010-07-07 Thread Rodion Raskolnikiv
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 tha