On 2/7/07, Antonio <[EMAIL PROTECTED]> wrote:
>
> * martedì 06 febbraio 2007, alle 20:10, Russell Keith-Magee wrote :
> > data.rims.add(req.POST.getlist('rims'))
Oops - sorry - missed a small, but very important bit - You need to
roll out the list as arguments. Ordinarily, the usage of add() would
be:
data.rims.add(1,3,7,9)
but since you already have a list, you use:
data.rims.add(*req.POST.getlist('rims'))
Sorry for leading you astray.
> I've try with:
>
> for newrim in req.POST.getlist('rims'):
> dati.rims.add(newrim)
This is effectively the same solution, but rolled out in code.
> but the data are added also when I update the Previsione ...
> searching on group archive, I think I must implement a 'save' method
> into the Previsione class ... is correct ?
I'm not sure I understand what you're trying to do here. The save()
method on an instance doesn't affect the m2m relations. However, there
are other mechanisms, such as saving a web form, that will modify m2m
forms.
How are you updating the Previsione instances? Using a web form?
Programmatically? Some other way?
> and if it's correct, how can I access the POST data from the save() method ?
In short, you can't. However, this doesn't stop you from adding a
different method to your model that has the side effect of calling
save.
Yours,
Russ Magee %-)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---