Is there a easier way to copy one entry from one table to another? From what I know, it is to create a entry in the other table and assign the value from the previous table to each fields of the new entry of the other table.
Can you give specifics on what you’re wanting to achieve - specifically? Will this be a repetitive thing? What database back end?
If this is one off - I’d just write a SELECT INTO query
Sorry for the missing information. I am using the default database (SQLite). Yes, it is a repetitive thing. Here’s a scenario of what is intended to happen.
I have a table called Job. This is the table that store entries for a job creation. Lets say if the user create a job and after awhile, wants to delete this job entry that is stored in the Job table. It will be coded to be deleted from the Job table. But before a complete deletion from this table. I want to store it in a table called Job_removed. Basically archive that the job was deleted. Like for the admin to see
This seems to be using the shell though. I want it to be coded in the views. Like any registered user on the web decide to click the delete button for the jobs they created, it get transferred to other table (Job_removed) and at the same time, it is deleted in Job table
You can use the code there in a view. It’s still all Python. Make a view and put that in it.
Another option might be something like
is_deleted Boolean field on the
You could then show only jobs where
is_deleted=False to your users, while the admin would see all and could possibly filter based on this field.
Thanks for the suggestion !
Oh, thats true. Thanks !
If they’re going to do that, I’d suggest a few fields. is_active, inactive_date, edit_user (or something a little more specific that “edit”) But you really mostly need the first two.
Maybe is_deleted, delete_date, delete_user