I've noticed something in Django formsets:
Each formset.form has a hidden field with the id of the model being edited. All one would need to do is change this id and submit, and the default formset clean() or save() methods don't bat an eye.
I would think that it wouldn't be too complicated to keep track of which objects were in the original formset queryset, and compare them on save. I wonder why Django doesn't do this already?
As for me, I'm checking permissions on formset save like:
if formset.is_valid():
for fs in formset:
report = fs.save(commit=False)
if can_edit(request.user, report):
report.save()
Anyone else notice this issue? I'd be curious to see how you've addressed it.
y(which isn't in the queryset) by changing the hidden id fromxtoy. If you have found otherwise, I think that's a security issue and it would be better to report it privately rather than posting on Stack Overflow. I don't think there's a specific reason for the current lack of error message - I think a patch would be welcomed. - Alasdairrequest.userhas edit permission on the model). I've just tried it. - Rob Lrequest.userat all. Are you talking about the Django admin? - Alasdair