mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2025-08-10 08:27:59 +02:00
Save custom fields in a followup
This commit is contained in:
@ -192,7 +192,27 @@ class EditTicketCustomFieldForm(EditTicketForm):
|
||||
super(EditTicketCustomFieldForm, self).__init__(*args, **kwargs)
|
||||
|
||||
del self.fields['merged_to']
|
||||
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
|
||||
# if form is saved in a ticket update, it is passed
|
||||
# a followup instance to trace custom fields changes
|
||||
if "followup" in kwargs:
|
||||
followup = kwargs.pop('followup', None)
|
||||
|
||||
for field, value in self.cleaned_data.items():
|
||||
if field.startswith('custom_'):
|
||||
if value != self.fields[field].initial:
|
||||
c = followup.ticketchange_set.create(
|
||||
field=field.replace('custom_', '', 1),
|
||||
old_value=self.fields[field].initial,
|
||||
new_value=value,
|
||||
)
|
||||
|
||||
super(EditTicketCustomFieldForm, self).save(*args, **kwargs)
|
||||
|
||||
|
||||
class Meta:
|
||||
model = Ticket
|
||||
exclude = ('title', 'queue', 'created', 'modified',
|
||||
|
Reference in New Issue
Block a user