Re: Prepopulate Slugfied from Foreign Key without using the id

2008-04-17 Thread Merrick
Thank you for that, I will have to study that because it is a lot cleaner than what I did. I added the following to my City model below Class Meta: def save(self): slug_parts = self.slug.split('-') num_slugs = len(slug_parts) state_position = (num_slugs - 1)

Re: Prepopulate Slugfied from Foreign Key without using the id

2008-04-17 Thread James Punteney
The javascript is part of the Simple pages app I've been working on so you can view the code here: http://code.google.com/p/django-simplepages/source/browse/trunk/simplepages/templates/pages/auto_url_prepend.js It's a little different than what you are doing as I'm not pulling the display value

Re: Prepopulate Slugfied from Foreign Key without using the id

2008-04-17 Thread Merrick
Hi James, thank you for responding, can you point me in the right direction with the javascript. --Merrick On Apr 17, 1:25 pm, "James Punteney" <[EMAIL PROTECTED]> wrote: > I ran into this issue the other day wanting to use a foreign key value to > prepopulate a slugfield and just getting

Re: Prepopulate Slugfied from Foreign Key without using the id

2008-04-17 Thread James Punteney
I ran into this issue the other day wanting to use a foreign key value to prepopulate a slugfield and just getting the id (if anything). According to the documentation[1] prepopulate doesn't support foreign keys, so I ended up going the custom javascript route in order to get it working. --James

Re: Prepopulate Slugfied from Foreign Key without using the id

2008-04-17 Thread Jeff Anderson
Merrick wrote: I setup the classes below in my model and would like to have access to the name of the state in the City model for use in the SlugField. As it is, I get the state id not the name of the state in the slugfield when I add a City through the admin. This is the correct behavior-- It

Prepopulate Slugfied from Foreign Key without using the id

2008-04-17 Thread Merrick
I setup the classes below in my model and would like to have access to the name of the state in the City model for use in the SlugField. As it is, I get the state id not the name of the state in the slugfield when I add a City through the admin. I know the admin is aware of this value because the