Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Django Forms Inlines and Media Inline Model Formset

I can not delete in the form

i'm using django 2.0.3, It quite difference. In the first time, the delete check box did not show up. But after try to read document, then add can_delete=True in AnswerFormSet, the checkbox just showed up , but i still can not delete the item, through i can modify all others field? Some one help me

1 Answer

I finally got the answer. By adding this code after checking the form is_valid

for delete_item in answer_forms.deleted_objects:

this code will iterate all the items being deleted and you can use delete() function to get rid all of this.