wooey / Wooey

A Django app that creates automatic web UIs for Python scripts.
http://wooey.readthedocs.org
BSD 3-Clause "New" or "Revised" License
2.14k stars 186 forks source link

Disable pre_save and post_save signals during loaddata #356

Closed Lioscro closed 2 years ago

Lioscro commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

Seems like a good fix, thanks!