tsg-humlab / shewrote

studying historical early women’s reception: oeuvres, texts, engagements / https://shewrote.rich.ru.nl/
0 stars 0 forks source link

Change on_delete= value where appropriate #6

Open vanlummelhuizen opened 11 months ago

vanlummelhuizen commented 11 months ago

See for instance https://github.com/tsg-humlab/shewrote/blob/dde56bccbf2b4c8dc9ddc2c69b9281a521c36130/shewrote/models.py#L34

on_delete=models.CASCADE here means that if the Place object is deleted, the Person object should also be deleted. I don't think that is what we want. models.SET_NULL is more appropriate, meaning the Person object is not affected other than setting the field to NULL (null=True is necessary).

See also https://docs.djangoproject.com/en/4.2/ref/models/fields/#django.db.models.ForeignKey.on_delete