Commit 70fcc92b by Kálmán Viktor

dashboard: issue 94 server-side

parent 19235ec6
......@@ -487,6 +487,16 @@ class TemplateForm(forms.ModelForm):
return User.objects.get(pk=self.instance.owner.pk)
return self.user
def clean(self):
cleaned_data = self.cleaned_data
# if raw_data has changed and the user is not superuser
if "raw_data" in self.changed_data and not self.user.is_superuser:
old_raw_data = InstanceTemplate.objects.get(
pk=self.instance.pk).raw_data
cleaned_data['raw_data'] = old_raw_data
return cleaned_data
def save(self, commit=True):
data = self.cleaned_data
self.instance.max_ram_size = data.get('ram_size')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment