Dear lazy #django web, a question:
When using to_field for a foreign key, what happens if the contents of the field on the foreign object is edited? Does it update in both places? Or unlink/break? or refuse to change (constraint)?
@keira_reckons
> what happens if the contents of the field on the foreign object is edited?
Three ways to answer that:
* This falls under the topic of "relational integrity": how (and whether) to ensure both ends of the defined relationship, fulfil the promise when one end is modified.
* The database engine will (or, for some very simple ones, will not) have ways to specify the behaviour, when that field is created on the table.
* The #Django ORM has corresponding options to specify that.
Most Relational DBMSen (#PostgreSQL, #MariaDB, etc.) have explicit options, when defining a foreign key relationship, to declare what must happen; see "ON DELETE RESTRICT", "ON UPDATE CASCADE", and the like.
#Django ORM `ForeignKey` currently allows specifying the "on delete" referential actions, but not "on update". https://code.djangoproject.com/ticket/21295
@bignose yeah that's why I wasn't sure if updating would be a thing.
I have some time tomorrow to play with it and find out. I was just hoping I could save a little time by asking the hive mind. But they weren't buzzing so much today :)