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 of the select box, I'm actually getting another value from the
foreign key object. I had to do the extra step of using django to print out
a javascript hash with the id's of the SiteSections as the key and the url
that I'm using to prepopulate text box (hence the reason this is a django
template file and not a plain javascript file).

Overall it's pretty close to what you are wanting to do though.

Hope that helps,
--James




On Thu, Apr 17, 2008 at 4:53 PM, Merrick <[EMAIL PROTECTED]> wrote:

>
> 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 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
> >
> > [1]http://www.djangoproject.com/documentation/model-api/#slugfield
> >
>

--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to