Parisson / Telemeta

Collaborative content management system for musicology
http://telemeta.org
GNU Affero General Public License v3.0
118 stars 38 forks source link

Remove WeakForeignKey #185

Closed thomasfillon closed 6 years ago

thomasfillon commented 7 years ago

Commit ee63244073e19244714327d1adce57dc096b3d3c add weakforeignkey in to "emulate sql ON DELETE SET NULL using WeakForeignKey and enhanced model/manager/queryset"

See models.fields.py line 202

This feature seems obsolete as it is provided by Django. see https://docs.djangoproject.com/en/1.8/ref/models/fields/#django.db.models.ForeignKey.on_delete

For example, if you have a nullable ForeignKey and you want it to be set null when the referenced object is deleted:

user = models.ForeignKey(User, blank=True, null=True, on_delete=models.SET_NULL)

Todo :

@yomguy do you confirm that EnhancedQuerySet, EnhancedManager, and EnhancedModel could be removed ? EnhancedModel is used as base-class for ModelCore but seems only to add weakforeignkey support. Is it wright ?

thomasfillon commented 7 years ago

notes:

thomasfillon commented 7 years ago

See Django documentation on Migrations: Considerations when removing model fields

thomasfillon commented 7 years ago

Fix with #186 in release/1.7