-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAEBCAAGBQJU5h1tAAoJEC0ft5FqUuEhy7MP/izvgUgAG/ztZ9CmzDI2tvfI
l1ODG7dppgw7J9v2zi9nHt8PNzqARdegTYM6KI6gAsKNSCI9KnOxT9+ncv7MMmdT
VHvIJtcBWDuYbYLG1m6PMcNpXdgpGH0R9ncDbaFg/QZhB8rG8YhYQFRpLjpxLE9m
DD+cum5orDueZLV4zkZ7XeWe9VWjrFj7/AHAlU89RoU9dsw24tWAkZshKMMK+oWg
SlV0z30S4GFdPW2ZT1g7mLul00ElyyCzLZdhjPPyH4AXjGhx7cFQWbm1DHN9zQuY
1YdFiVzfqmH8TsGKk9ge585Owns4pgwR+u9T9KmtzxURfVjmaLHGOMyLF4jWoP+U
2fsDKCtT5bWkQ80IuX7OGdZL3TfSU0MptZGe9sSFzQbqH3HewGfXcukqf3BiIIM7
aHo8cDnY6WMgHjlQGVMZ7iFON1izp863m82RCf0V6r3tcMFz5Xz91IXoMiZRwERp
aHi8T8nwBJhzYkBOX2bST2AtD9hkXUsH+HWdQ/UDXxMG/9/1qsapeuR/JPnr6cH0
9Wi1iTPQkwWe7++E8QgeXsbFBAXjokDulz12rzqmxoQWJpgm8g+hllC5+qHEMiba
yLFA7ENyjURLZxCiUH0ynXOyNoqYxWVt1QAHjNkBK9hublcwttkbgmCULJ34T627
XI4J2NrcEDWRishkj3W9
=zdq8
-----END PGP SIGNATURE-----
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+unsubscribe@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.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment