From 3bc70f24f802a61c319bc927d2f599a1a2901b15 Mon Sep 17 00:00:00 2001 From: Samuel Gaist <samuel.gaist@idiap.ch> Date: Wed, 22 Aug 2018 15:37:19 +0200 Subject: [PATCH] [plotters][admin] Fix immutable query object modification error Work now on copy of QueryObject as recommended in the Django documentation and replace the original with the copy --- beat/web/plotters/admin.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/beat/web/plotters/admin.py b/beat/web/plotters/admin.py index 83d0dd6a3..d3f9cc85c 100644 --- a/beat/web/plotters/admin.py +++ b/beat/web/plotters/admin.py @@ -27,11 +27,10 @@ '''Administrative add-on for the extended Django User model''' -import six - from django.contrib import admin from django import forms from django.core.files.base import ContentFile +from django.utils import six from ..common.texts import Messages @@ -134,7 +133,9 @@ class PlotterModelForm(forms.ModelForm): if 'declaration_file' in self.data and \ isinstance(self.data['declaration_file'], six.string_types): - self.data['declaration_file'] = ContentFile(self.data['declaration_file'], name='unsaved') + mutable_data = self.data.copy() + mutable_data['declaration_file'] = ContentFile(self.data['declaration_file'], name='unsaved') + self.data = mutable_data #---------------------------------------------------------- -- GitLab