Re: Updating and saving a related record. How does it work?

2006-11-30 Thread Aidas Bendoraitis
Have you tried Jacob's suggestion with the model, or its instance? You should have done that with an instance. I would also advice you to use lower case for variables(instances)/functions and capitalized words only for classes(models). Otherwise you confuse yourself and people who might help

Re: Updating and saving a related record. How does it work?

2006-11-29 Thread MerMer
I am finding that the following intermediate step is required. Comp=Promo.competition This changes the class from Promotion to Competition and I can then make the changes Comp.total_value=3000 Comp.save() However, I'm no wiser why the earlier solution by Jacob is not working for me.

Re: Updating and saving a related record. How does it work?

2006-11-29 Thread MerMer
Jacob, I had tried that, but it's not working for me.I get the following:- Promo=Promotion.objects.get(id=1) Promo.competition.total_value >> 2000 Promo.competition.total_value=3000 Promo.competition.save() Promo.competition.total_value >> 2000 I must be doing something stupid, but can't

Re: Updating and saving a related record. How does it work?

2006-11-29 Thread Jacob Kaplan-Moss
On 11/29/06 11:31 AM, MerMer wrote: > However, I can't work out how to save a different value to the field > using something like > > Promotion.competition.total_value=3000 Promotion.competition.save() Jacob --~--~-~--~~~---~--~~ You received this message

Updating and saving a related record. How does it work?

2006-11-29 Thread MerMer
I was able to save a record like so... Promotion.total_value=2000 Promotion.save() However, I recently moveed the "total_value" field into another model which has a OneToOne relationship with the Promotion Model. Know I can access total_value like so:- Promotion.competition.total_value >>