Merge pull request #927 from Benbb96/fix-926

Fix #926, TicketCustomFieldValue Boolean (if not required) does not set in EditTicketForm
This commit is contained in:
Garret Wassermann 2021-01-16 18:00:48 -05:00 committed by GitHub
commit aeb3bf0762
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -98,6 +98,9 @@ class EditTicketForm(CustomFieldMixin, forms.ModelForm):
try:
current_value = TicketCustomFieldValue.objects.get(ticket=self.instance, field=field)
initial_value = current_value.value
# If it is boolean field, transform the value to a real boolean instead of a string
if current_value.field.data_type == 'boolean':
initial_value = initial_value == 'True'
except TicketCustomFieldValue.DoesNotExist:
initial_value = None
instanceargs = {