Re: overriding save() for ManyToManyFields

2009-09-24 Thread Daniele Procida
On Thu, Sep 24, 2009, Daniele Procida wrote: >>So, given a obj = Referrer("foo"), updating its many-to-many field can >>happen only after obj.save() returns (this is documented in >>http://www.djangoproject.com/documentation/models/many_to_many/ ). >> >>If you are not able to call obj.save() and

Re: overriding save() for ManyToManyFields

2009-09-24 Thread Daniele Procida
On Thu, Sep 24, 2009, mrts wrote: >So, given a obj = Referrer("foo"), updating its many-to-many field can >happen only after obj.save() returns (this is documented in >http://www.djangoproject.com/documentation/models/many_to_many/ ). > >If you are not able to call obj.save() and then manually u

Re: overriding save() for ManyToManyFields

2009-09-24 Thread mrts
On Sep 24, 12:52 am, "Daniele Procida" wrote: > Don't I need to run some sort of save for those? Otherwise, what happens > to the attributes once I have set them? Sorry, I responded too hastily and erroneously. Here's the proper, longer explanation. Assume the following models: class Referee(m

Re: overriding save() for ManyToManyFields

2009-09-23 Thread Daniele Procida
On Wed, Sep 23, 2009, mrts wrote: >> So, obviously I need another stage, to save the many-to-many relations >> once theo bject is saved. > >Call super(Event, self).save(), then update the many-to-many >relations. Don't I need to run some sort of save for those? Otherwise, what happens to the at

Re: overriding save() for ManyToManyFields

2009-09-23 Thread mrts
On Sep 23, 10:40 am, "Daniele Procida" wrote: > So, obviously I need another stage, to save the many-to-many relations > once theo bject is saved. Call super(Event, self).save(), then update the many-to-many relations. --~--~-~--~~~---~--~~ You received this mess

overriding save() for ManyToManyFields

2009-09-23 Thread Daniele Procida
My model has a save() override, in which a number of attributes (which are ManyToManyFields) need to get their values from the object's parent: def save(self): if self.parent: attribute_list = ['publishing_destinations', 'registration_enquiries', 'speakers', 'related_peopl