bdauer / tasktracker

tracker for one-off, timed and recurring tasks scheduled for or due on a given day.
2 stars 0 forks source link

Add ID for recurring tasks to track relationship. #25

Closed bdauer closed 7 years ago

bdauer commented 7 years ago

The same recurring tasks should have a shared ID so that it's possible to track their relationship. That way, if the task is removed by the user, all instances will be removed.

It probably shouldn't be the name of the task because two tasks could exist with the same name.

bdauer commented 7 years ago

Consider copying the pk of the original task into a separate field for tracking the relationship

bdauer commented 7 years ago

The pk isn't accessible from CreateTaskView's form_valid method, I think because it's autogenerated by the database. That means I'll need to look into a different solution, maybe using a signal. I need to assign the shared id before calling Task.add_next_recurring_date(). Otherwise the next date won't have the shared id.

bdauer commented 7 years ago

I tried using a signal, triggered by the form's post_save based off of the idea that the form would still behave as a model. That didn't work out. After a little more sleuthing I decided to generate a UUID. The related recurring tasks are now linked up!