crazycooky77 / ci_project4

0 stars 1 forks source link

[BUG] Unable to delete last set in collection #42

Closed crazycooky77 closed 6 months ago

crazycooky77 commented 7 months ago

When deleting all sets in a collection, all except 1 are deleted. The last one is not deleted. This also happens when there is only one set in the collection. When trying to delete the only set, it is not deleted. You can delete the set if you add others, and then delete the 1 (or multiple, but not all).

The issue is in views.py (currently line 309 and 310). Initial attempts to fix are unsuccessful. Needs to be fixed in a future iteration.

crazycooky77 commented 6 months ago

Resolved with the help of Tutor Support. Needed to change:

LegoCollection.objects.filter(pk__in=set_del_pk).delete()
form.save()

to:

form.save()
LegoCollection.objects.filter(pk__in=set_del_pk).delete()