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
Victor Gavojdea
11,796 PointsGetting a ValidationError at edit_question: ['ManagementForm data is missing or has been tampered with']
I checked forms.py, question_form.html, and views.py and my code looks like Kenneth's, maybe I've been at it too long... Do any of you see it?
if request.method == 'POST':
form = form_class(request.POST, instance=question)
answer_forms = forms.AnswerInlineFormSet(
request.POST,
queryset=form.instance.answer_set.all()
)
if form.is_valid() and answer_forms.is_valid():
form.save()
answers = answer_forms.save(commit=False)
for answer in answers:
answer.question = question
answer.save()
messages.success(request, "Updated question")
return HttpResponseRedirect(question.quiz.get_absolute_url())
I posted this snippet because the error page was pointing me to validation lines (if forms and answer_forms is valid)
Alx Ki
Python Web Development Techdegree Graduate 14,810 PointsAlx Ki
Python Web Development Techdegree Graduate 14,810 PointsHi, Victor Gavojdea ! I'd check form set creation and form validation.
You may post forms.py and question_form.html here and I'll try to find problem.