On Fri, Jun 01, Sacher Khoudari wrote:

> can I add a book to an author? I mean, how do I call
> "django.views.generic.create_update.object_create" with "model=Book",
> and pass it the value for it's foreign key?

You're right, generic views are quite limited. And they work only with
"oldforms", which are due to be replaced with "newforms", so it isn't really
worth improving. 

I personally am still with oldforms, and I like a programming style where I
don't write all the form handling code into my custom views. Instead, I've
patched the original generic views to accept a custom manipulator. With
this, I handle everything special (and also your case) within the
manipulator. Additional data like your foreign key would be passed to the
__init__() function of the manipulator.

Michael


-- 
noris network AG - Deutschherrnstraße 15-19 - D-90429 Nürnberg -
Tel +49-911-9352-0 - Fax +49-911-9352-100
http://www.noris.de - The IT-Outsourcing Company
 
Vorstand: Ingo Kraupa (Vorsitzender), Joachim Astel, Hansjochen Klenk - 
Vorsitzender des Aufsichtsrats: Stefan Schnabel - AG Nürnberg HRB 17689

--~--~---------~--~----~------------~-------~--~----~
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