did you look through this:
http://www.djangosnippets.org/snippets/1097/

which is similar

> Now this is where I lose the plot:
> a. How to get it to validate. (clean and co.)

when you select the desired whatever it should put it into the form's
hidden field as an id
or text field
so that's what should be cleaned.

> b. How to get it to save an author object on form.save()

the form probably doesn't need to know about the particulars of the
widget

the Field cleans it (just to be safe)

>
> I am going to re-code today without using modelForms because I think hooking
> into that voodoo is too complex for my light-weight brain.

yes, that twists my brain too


On Oct 1, 10:22 am, Donn <[EMAIL PROTECTED]> wrote:
> Hi,
> I asked a little earlier, but this is a busy list and perhaps my post was too
> obscure. Here is an edited repost in the hopes of catching someone who can
> help out:
>
> I am trying to create a custom field (and/or widget) that 'looks up' a foreign
> key relation -- i.e. lists the other table and allows a pick of an item.
>
> It's about books and authors.
>
> 1. A 'book' has a title (string) and an author (foreign key).
> 2. I use a ModelForm from the model.
> 3. I want the 'author' form-control to look like this:
> Author:______ [click here to choose or add an author]
> 4. When you click the link it opens a div.
> 5. The div shows all the authors (and has an add form)
> 6. When you click on an author it fetches the pk from the link (all done with
> jquery)
> 7. It then (should) leave the control something like:
> Author:38 Bear, Greg [click here to ...]
>
> Step 3 is a problem. I have tried various combinations of things. A new field
> type, a new widget etc. The other steps (bleev it or not) are working!
>
> Now this is where I lose the plot:
> a. How to get it to validate. (clean and co.)
> b. How to get it to save an author object on form.save()
>
> I am going to re-code today without using modelForms because I think hooking
> into that voodoo is too complex for my light-weight brain. I still hope for a
> few tips tho!
>
> \d
--~--~---------~--~----~------------~-------~--~----~
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