Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Improve default copy method to also copy placeholders and plugins #345

Draft
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

fsbraun
Copy link
Member

@fsbraun fsbraun commented Jul 24, 2023

Description

Versioning allows specifying a copy method to allow for copying foreign keys, one-to-one fields in a meaningful way for the specific model.

One of the most relevant relations will be placeholders and their plugins.

To avoid code repetition of largely identical copy methods in any package using djangocms-versioning, I propose to include coyping placeholders in versioned models by default.

This would make custom copy functions obsolete in alias and blog and other content objects to come.

Also, if the verisoned model has a method copy_relations it is called on the new object allowing to keep simple copy information within the model.

Tests follow.

Related resources

  • #...
  • #...

Checklist

  • I have opened this pull request against master
  • I have added or modified the tests when changing logic
  • I have followed the conventional commits guidelines to add meaningful information into the changelog
  • I have read the contribution guidelines and I have joined #workgroup-pr-review on
    Slack to find a “pr review buddy” who is going to review my pull request.

@codecov
Copy link

codecov bot commented Jul 24, 2023

Codecov Report

Attention: Patch coverage is 23.52941% with 13 lines in your changes are missing coverage. Please review.

Project coverage is 91.15%. Comparing base (f90c5b2) to head (b04488e).
Report is 13 commits behind head on master.

Files Patch % Lines
djangocms_versioning/datastructures.py 23.52% 11 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #345      +/-   ##
==========================================
+ Coverage   90.88%   91.15%   +0.26%     
==========================================
  Files          72       72              
  Lines        2546     2589      +43     
  Branches      361      373      +12     
==========================================
+ Hits         2314     2360      +46     
+ Misses        168      164       -4     
- Partials       64       65       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@fsbraun fsbraun marked this pull request as ready for review September 11, 2023 08:50
@fsbraun fsbraun marked this pull request as draft September 11, 2023 09:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

1 participant