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.11k stars 182 forks source link

Unable to delete Scripts! #308

Closed 8ball030 closed 4 years ago

8ball030 commented 4 years ago

Hi All, first up I just wanted to say I love this project. It is great and i now manage all of my scripts using this tool.

Unfortunately, I am having a small issue where I am unable to delete scripts once they have been uploaded :(

It seems to strike when I have renamed a script using the admin app. I then use the cli tool to add a new version with changes. This then leads to a situation where I can see 2 versions of the script on the main page, the script with the actual name of the file which has been added via the cli, and then the second which has my new name.

So, I then try to delete the older version, and I am being greated with this message;

Cannot delete script
Deleting the script 'Data Merger and Classifier' would require deleting the following protected related objects:

Script version: Data Merger and Classifier(1: 1)

I would really appreciate the help getting this resolved!

Kindest regards, 8ball

Chris7 commented 4 years ago

Hey @8ball030 ,

Thanks for the report. I think I can reproduce this. I'm guessing your goal is for the updated script versions to go under the renamed script?

Chris

8ball030 commented 4 years ago

Hi @Chris7,

Yes that is what I was hoping for!

If you wanted to point me in the right direction, I am more than happy to offer support to get this implemented :)

Kindest regards, 8ball030

Chris7 commented 4 years ago

I was thinking a bit about this, and am wondering if it is at all possible for it to be performed automatically. The default name via the command line is the filename. If that doesn't match an existing script, a new script is made. How do we know to link to the previously renamed script?

One way to get around this is to use the --name argument in the command line. Is there a reason that is not sufficient for uploading scripts?

A quick tangent: In the backend, there is the concept of a ScriptVersion and a Script. A ScriptVersion is a unique copy of a given file, that is grouped under a Script. There is a foreign key relationship between a ScriptVersion and a Script. This is a protected object, where existing ScriptVersions block deletion of the Script. So to delete a script, the ScriptVersinos must be deleted first.

8ball030 commented 4 years ago

Hi @Chris7 Really sorry about the lack of communication here. Corona has been a bit.. distracting shall we say. I have attempted to use the Name flag and yes, you are correct this will suffice to help me. Unfortunately when I am using this flag, it does nto seem to update the script. I do not get an error, however i get a 0 scripts converted message. Additionally, I have been trying to find the ScriptVersion, however I cannot seem to modify that from the front end in order to delete the old scripts I have which as no longer needed. Thanks for the support here, this is a really cool project.

Chris7 commented 4 years ago

I understand, I'm in the middle of it as well (we're booting up a few projects to help with the response at work).

So, this is what you need to do. Go to the script that you want to delete in the Django admin, then scroll to the bottom where all the versions of the script are stored. Click the checkbox next to each version in the delete column and click save. Then you will be able to delete the script. I purposefully protected it, but this might be a bit excessive...

8ball030 commented 4 years ago

Hi, Thanks for the help,

1). Navigate to the admin page and the script; image 2) Check the delete boxes and save; This appears at teh top of the screen; image

3) The we get this at the script version part of the page; image I am beginning to think its something strange to do with my deployment (based from your docker-compose repo!)

Chris7 commented 4 years ago

Ah, that makes sense. You have jobs with that script as well. Let me look at what happens if I stop protecting these models (it'd result in a mass delete of a bunch of things, but if oyu wanted to remove the script, i guess that is what would be warranted.)

Chris7 commented 4 years ago

I put a change to allow this in the latest master. Feel free to test there, or wait for an official release

Chris7 commented 4 years ago

Latest version 0.12.0 released. Please let me know if this resolved.