forked from extern/django-helpdesk
Bug Fix EditTicketForm unable to edit and add error display
This commit is contained in:
parent
e52471b49b
commit
ae9109bad6
@ -83,12 +83,6 @@ class CustomFieldMixin(object):
|
||||
|
||||
|
||||
class EditTicketForm(CustomFieldMixin, forms.ModelForm):
|
||||
merged_to = forms.ModelChoiceField(
|
||||
label=_('Merged to'),
|
||||
help_text=_('This ticket is merged into the selected ticket.'),
|
||||
queryset=Ticket.objects.all(),
|
||||
disabled=True
|
||||
)
|
||||
|
||||
class Meta:
|
||||
model = Ticket
|
||||
@ -100,6 +94,10 @@ class EditTicketForm(CustomFieldMixin, forms.ModelForm):
|
||||
"""
|
||||
super(EditTicketForm, self).__init__(*args, **kwargs)
|
||||
|
||||
# Disable and add help_text to the merged_to field on this form
|
||||
self.fields['merged_to'].disabled = True
|
||||
self.fields['merged_to'].help_text = _('This ticket is merged into the selected ticket.')
|
||||
|
||||
for field in CustomField.objects.all():
|
||||
try:
|
||||
current_value = TicketCustomFieldValue.objects.get(ticket=self.instance, field=field)
|
||||
|
@ -26,6 +26,7 @@
|
||||
<strong>{% trans "Note" %}:</strong>
|
||||
{% blocktrans %}Editing a ticket does <em>not</em> send an e-mail to the ticket owner or submitter. No new details should be entered, this form should only be used to fix incorrect details or clean up the submission.{% endblocktrans %}
|
||||
</p>
|
||||
{% if errors %}{% for error in errors %}{% trans "Error: " %}{{ error }}{% endfor %}{% endif %}
|
||||
<form method='post'>
|
||||
{% csrf_token %}
|
||||
<fieldset>
|
||||
|
@ -1218,7 +1218,7 @@ def edit_ticket(request, ticket_id):
|
||||
ticket = form.save()
|
||||
return redirect(ticket)
|
||||
|
||||
return render(request, 'helpdesk/edit_ticket.html', {'form': form, 'ticket': ticket})
|
||||
return render(request, 'helpdesk/edit_ticket.html', {'form': form, 'ticket': ticket, 'errors': form.errors})
|
||||
|
||||
|
||||
edit_ticket = staff_member_required(edit_ticket)
|
||||
|
Loading…
Reference in New Issue
Block a user