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

Add pre and post clone save signals #680

Merged
merged 5 commits into from
Nov 3, 2022
Merged

Add pre and post clone save signals #680

merged 5 commits into from
Nov 3, 2022

Conversation

yuekui
Copy link
Contributor

@yuekui yuekui commented Nov 2, 2022

So we could potentially get rid of pre_save_duplicate and keep flexible.
Also removed the 2nd save() since we've moved __duplicate_m2o_fields before saving.

@codecov
Copy link

codecov bot commented Nov 2, 2022

Codecov Report

Merging #680 (e2f0265) into main (d1188f2) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main      #680   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            2         2           
  Lines          288       290    +2     
=========================================
+ Hits           288       290    +2     
Impacted Files Coverage Δ
model_clone/mixin.py 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

slug=slugify(name),
published_at=first_published_at,
)
assert book.published_at == first_published_at

Check warning

Code scanning / Bandit (reported by Codacy)

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
assert book.published_at == first_published_at
edition = Edition.objects.create(seq=1, book=book)
cloned_edition = edition.make_clone()
assert cloned_edition.seq == 2

Check warning

Code scanning / Bandit (reported by Codacy)

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
cloned_edition = edition.make_clone()
assert cloned_edition.seq == 2
book.refresh_from_db()
assert book.published_at != first_published_at

Check warning

Code scanning / Bandit (reported by Codacy)

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.

Use of assert detected. The enclosed code will be removed when compiling to optimised byte code.
@yuekui yuekui force-pushed the main branch 2 times, most recently from 4f020e8 to 29677e9 Compare November 3, 2022 00:09
@jackton1 jackton1 merged commit 56342be into tj-django:main Nov 3, 2022
@jackton1
Copy link
Member

jackton1 commented Nov 3, 2022

@yuekui Thanks for the update much appreciated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants