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

Inappropriate verbiage in the signals documentation #1300

Open
cmaggiulli opened this issue Jan 24, 2024 · 1 comment
Open

Inappropriate verbiage in the signals documentation #1300

cmaggiulli opened this issue Jan 24, 2024 · 1 comment

Comments

@cmaggiulli
Copy link

cmaggiulli commented Jan 24, 2024

Describe the bug
In the documentation related to this projects signals the following text, "Sent before saving historical record", is printed by the pre_create_historical_record signal. However, this verbiage is wrong. It does not happen "before saving historical record". It happens before the creation of the historical record ( before the saving of the respective base object )".

I would like to change this verbiage to more accurately reflect whats happening.

To Reproduce
Steps to reproduce the behavior:

  1. Navigate to https://django-simple-history.readthedocs.io/en/latest/signals.html
  2. Read the description

Expected behavior
That code should execute before the creation of the historical record, not before "saving" the historical record

Screenshots
N/A

Environment (please complete the following information):
N/A

Additional context
Please allow me to make the fix as I'd like to start contributing to the project. I want to learn the contribution workflow. Ive already made the changes in this commit 8993d85

If anyone wants to suggest a different wording let me know and Ill update the PR. This actually caused confusion for me because I have the following code

@receiver(post_create_historical_record, sender=UnitRule.history.model)
def record_effective_end_date(sender, signal, instance, history_instance, **kwargs):

    time_of_change = timezone.now()

    history_instance.modified = time_of_change
    history_instance.save()

    if prev_instance := history_instance.prev_record:
	    prev_instance.effective_end_date=time_of_change
	    prev_instance.modified=time_of_change
	    prev_instance.save()

and I was concerned it was going to create an infinite loop based off the word "saving" in the example

@cmaggiulli
Copy link
Author

If anyone has any recommendation for verbiage other than what is in my commit please post here

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

No branches or pull requests

1 participant