Model objects versions in Django
Posted
by pablo
on Stack Overflow
See other posts from Stack Overflow
or by pablo
Published on 2010-03-12T01:02:39Z
Indexed on
2010/03/12
1:07 UTC
Read the original article
Hit count: 287
Hi
I'm building an e-commerce website. I have a Product and Order models. It's possible that a customer order a product and then the admin change its price or other fields before the customer actually get it.
A possible solution is to add a 'version' field to the Product model. When the admin update a product field I'll add a timestamp and create a new object instead of updating the old one. An Order will have a reference to a specific product version.
Does this make sense? Will overriding the Product Save method be sufficient to make it work?
Thanks
© Stack Overflow or respective owner