>
> 1. How do I create a Model Manager?

See http://docs.djangoproject.com/en/dev/topics/db/managers/

2. Within a view, what is the best way to add entries into tables that
> have a M2M relationship with an intermediate table?  I've been reading
> the following documentation with command line options, but I have not
> been able to put a cohesive view method together for my models above.
> Is there any examples of how to add to M2M tables within a view?
> http://docs.djangoproject.com/en/dev/ref/models/relations/
> http://www.djangoproject.com/documentation/models/m2m_intermediary/


Instead of creating a form from the Quote model, create a modelform from the
QuoteHasProduct form.

You need to enter the relationship and extra data through the intermediary
model:
qhp = QuoteHasProduct.objects.create(product=..., quote=..., quantity=...,
etc)

If you want to do this at the same time with creating a Quote, put the two
modelforms on the same page with a prefix added. (see
http://docs.djangoproject.com/en/dev/ref/forms/api/#prefixes-for-forms).
Then in your view you can first save the Quote, and then create the
relationship with its extra attributes.

TiNo

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