-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Anssi,
On 12/02/2011 06:54 PM, Kääriäinen Anssi wrote: > I think I will pursuit the immutable PK approach, and see how it > works (back to square one). BTW are there -1 calls on this approach, > or the pk change tracking in general? I haven't been fully following this thread, but I will say that I'm not yet convinced that the ORM behavior should be changed such that saving an instance with a modified PK updates the row rather than saving a new instance. The two foremost concerns: 1. Backwards compatibility. I think this was mentioned, but I didn't see a clear plan put forward. We certainly can't just break existing code that is using PK-modification or PK-clearing as a cloning technique. 2. Foreign keys. Do you plan to introduce a full update-cascade framework similar to the delete-cascade one, to handle the case where there are other models with FKs pointing to the model whose PK you are about to modify? How will you handle databases that aren't able to suspend constraint checking until the end of a transaction? I could be convinced otherwise, but at this point my feeling is that the current behavior is a reasonably good fit for the character of the Django ORM: simple and (not quite anymore, but still almost) stateless. For better or worse, a PK is what uniquely identifies a model instance as corresponding to a particular table row. If you change the PK, your instance no longer corresponds to the same row. Carl -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iEYEARECAAYFAk7ZhwgACgkQ8W4rlRKtE2ejtwCgkkH0+hX92NPQPFfhpJjkxB3B UWEAn3ae30eKxRdkqWmqYYs4/ka4FY1G =7VB1 -----END PGP SIGNATURE----- -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.