Hi Abraham, On 02/19/2015 03:41 AM, Abraham Varricatt wrote: > I've heard of the term 'atomic operations' , but didn't realize it had > support in django. Thank you for the detailed explanation!
You're welcome. > It's an interesting idea - to mark the field in the database as a > positive integer, but since it doesn't apply to all DBs, I think I'll > keep it aside for now. This is a bit of a tangent, but when you get to the point of worrying about things like race conditions and transactional behavior, your life will be easier if you simply choose a database for your project and don't worry about making everything cross-database portable. And, frankly, if you're concerned about data integrity, your life will be easier if the database server you choose is PostgreSQL. Your ability to use Django effectively is much greater if you know your specific database well, and aren't afraid to use database-specific features and write some raw SQL now and then. Limiting yourself to cross-database-portable ORM features is a significant handicap, one which I think only separately-distributed reusable apps should take on. In your particular case, without a database-level check constraint on the quantity field, it becomes much trickier to ensure that quantity can't go negative. > @Waitman, > > Don't think I've ever come across the term 'backorder', but its an > interesting concept. And very appreciated, from the business angle. I > need to think more on this. Yes - I should have said more clearly that my answer was intended as a primer on basic atomicity and locking concepts, not a treatise on shopping cart user experience. It's quite likely that for a production shopping cart you'd want significantly more sophisticated behavior than I covered. Carl -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/54E61D6D.2030006%40oddbird.net. For more options, visit https://groups.google.com/d/optout.
signature.asc
Description: OpenPGP digital signature