Opened 12 years ago

Closed 12 years ago

#540 closed task (fixed)

Add "delete" function to MediaEntry

Reported by: spaetz Owned by:
Priority: major Milestone: 0.3.3
Component: programming Keywords: review
Cc: Parent Tickets:

Description

Just working on issue 302 (Delete your own account), noticing that deleting a MediaEntry and all related Comments / Files / Tags / Collections has to be done manually e.g. in user_pages/views.py:media_confirm_delete().

It would make sense to provide a "delete()" function for MediaEntry that did all this work centrally. It would simplify the view functions and put the internal implementation details into the db models where they belong. It would also enable me to easily delete all user's media from the delete_user_account function without having to manually duplicate the thing.

Change History (4)

comment:1 by spaetz, 12 years ago

P.S. The "Base" Superclass of all models provides a "delete" function which brutally kills the model instance, without taking care of related files etc. So we'll need to provide a subclassed "delete()" that cleans up files and related comments etc and then calls "Base()"'s delete().

Does this make any sense or am I totally off here?

comment:2 by spaetz, 12 years ago

Milestone: 0.3.3

First cut in my branch 540_User_delete_deletes_related_entries at git://gitorious.org/~spaetz/mediagoblin/spaetz-mediagoblin.git

Note: We should also check why the "cascade delete orphanes" was not working. Deleting a user should also have invoked delete on the child MediaEntries, but they were still in the sqlite.db if I did not mess things up.

Last edited 12 years ago by spaetz (previous) (diff)

comment:3 by spaetz, 12 years ago

Keywords: review added

Just updated the branch to master. It should allow the deletion of a User including all of her Media files now. The frontend work for this is in a different branch as part of issue #302

comment:4 by spaetz, 12 years ago

Resolution: fixed
Status: newclosed

The User.delete() and MediaEntry.delete() functions have now been implemented and been pushed to master. What remains to be done is the frontend work in issue #302.

Note: See TracTickets for help on using tickets.