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)
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
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
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
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
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
6 matches
Mail list logo