Skip to content

Disable pre_save and post_save signals during loaddata#356

Merged
Chris7 merged 2 commits into
wooey:masterfrom
Lioscro:disable-signal-for-raw
Aug 9, 2022
Merged

Disable pre_save and post_save signals during loaddata#356
Chris7 merged 2 commits into
wooey:masterfrom
Lioscro:disable-signal-for-raw

Conversation

@Lioscro
Copy link
Copy Markdown
Collaborator

@Lioscro Lioscro commented Aug 8, 2022

This PR adds functionality to disable pre_save and post_save signals when the raw keyword argument is True, which is the case when fixtures are being loaded via the loaddata Django admin command.

This makes it overall easier to set up fixtures and seed the database for local development. If the signals are not disabled, every time a fixture for a ScriptVersion is being loaded, the backend tries to validate the script (which doesn't actually exist as a file on the host).

@Chris7
Copy link
Copy Markdown
Member

Chris7 commented Aug 8, 2022

What are you trying to do that you hit this? I've actually liked our signal use less and less over the years so it could make sense to take a different route.

@Lioscro
Copy link
Copy Markdown
Collaborator Author

Lioscro commented Aug 8, 2022

What are you trying to do that you hit this? I've actually liked our signal use less and less over the years so it could make sense to take a different route.

I'm trying to set up fixtures for staging and local environments, but when the signals are active, django-admin loaddata fails because the signal tries to access the actual scripts, which don't exist.

@Chris7 Chris7 merged commit ff42881 into wooey:master Aug 9, 2022
@Chris7
Copy link
Copy Markdown
Member

Chris7 commented Aug 9, 2022

Seems like a good fix, thanks!

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