Skip to content
Snippets Groups Projects

Feature/provenance

Merged Carlos Vega requested to merge feature/provenance into master
All threads resolved!
Files
5
@@ -34,14 +34,14 @@ class AppointmentForm(ModelForm):
for field in self.changed_data:
new_value = self.cleaned_data[field] or self.data[field]
if isinstance(new_value, QuerySet):
new_human_values = '; '.join([str(element) for element in new_value])
new_value = ','.join([str(element.id) for element in new_value]) # overwrite variable
# old value
if self.instance.id: # update instance
previous_value = getattr(self.instance, field).all()
old_human_values = '; '.join([str(element) for element in previous_value])
previous_value = ','.join([str(element.id) for element in previous_value]) # overwrite variable
else: # new instance
new_human_values = '; '.join([str(element) for element in new_value])
new_value = ','.join([str(element.id) for element in new_value]) #overwrite variable
#old value
if self.instance.id: #update instance
list_of_values = getattr(self.instance, field).all()
old_human_values = '; '.join([str(element) for element in list_of_values])
previous_value = ','.join([str(element.id) for element in list_of_values])
else: #new instance
old_human_values = ''
previous_value = ''
# description
Loading