django-cms / djangocms-versioning

General purpose versioning package for Django CMS 4 and above.
Other
33 stars 29 forks source link

fix: deletion of version objects blocked by source fields #320

Closed fsbraun closed 1 year ago

fsbraun commented 1 year ago

Description

source fields refer to Version objects a version was originally derived (copied) from. They are declared with on_delete = models.PROTECT. This blocks deletion of versioned objects (such as pages) which have sources.

If DJANGOCMS_VERSIONING_ALLOW_DELETING_VERSIONS is set to True, on_delete = models.SET_NULL removes the block and a user with permissions to delete Version objects can delete pages.

Remark: This does not affect the models.PROTECT setting for the Version.content.

Related resources

Checklist

codecov[bot] commented 1 year ago

Codecov Report

Merging #320 (2592545) into master (6d062b2) will increase coverage by 0.02%. The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #320      +/-   ##
==========================================
+ Coverage   89.96%   89.99%   +0.02%     
==========================================
  Files          68       68              
  Lines        2253     2259       +6     
  Branches      300      301       +1     
==========================================
+ Hits         2027     2033       +6     
  Misses        171      171              
  Partials       55       55              
Impacted Files Coverage Δ
djangocms_versioning/migrations/0003_version.py 100.00% <ø> (ø)
...cms_versioning/migrations/0015_version_modified.py 100.00% <ø> (ø)
djangocms_versioning/conf.py 100.00% <100.00%> (ø)
...gocms_versioning/migrations/0014_version_source.py 100.00% <100.00%> (ø)
djangocms_versioning/models.py 95.05% <100.00%> (+0.13%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.