mirror of
https://gitea.mueller.network/extern/django-helpdesk.git
synced 2024-11-22 07:53:19 +01:00
Disabled merged_to field in edit ticket + reformat template (fix datepicker) and simplify view
This commit is contained in:
parent
aeb3bf0762
commit
2a03a5ecf7
@ -83,6 +83,12 @@ class CustomFieldMixin(object):
|
|||||||
|
|
||||||
|
|
||||||
class EditTicketForm(CustomFieldMixin, forms.ModelForm):
|
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:
|
class Meta:
|
||||||
model = Ticket
|
model = Ticket
|
||||||
|
@ -1,58 +1,52 @@
|
|||||||
{% extends "helpdesk/base.html" %}{% load i18n bootstrap4form %}
|
{% extends "helpdesk/base.html" %}
|
||||||
|
|
||||||
|
{% load i18n bootstrap4form %}
|
||||||
|
|
||||||
{% block helpdesk_title %}{% trans "Edit Ticket" %}{% endblock %}
|
{% block helpdesk_title %}{% trans "Edit Ticket" %}{% endblock %}
|
||||||
|
|
||||||
{% block helpdesk_breadcrumb %}
|
{% block helpdesk_breadcrumb %}
|
||||||
<li class="breadcrumb-item">
|
<li class="breadcrumb-item">
|
||||||
<a href="{% url 'helpdesk:list' %}">{% trans "Tickets" %}</a>
|
<a href="{% url 'helpdesk:list' %}">{% trans "Tickets" %}</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="breadcrumb-item">
|
<li class="breadcrumb-item">
|
||||||
<a href="{% url 'helpdesk:list' %}{{ ticket.id }}/">{{ ticket.queue.slug }}-{{ ticket.id }}</a>
|
<a href="{% url 'helpdesk:list' %}{{ ticket.id }}/">{{ ticket.queue.slug }}-{{ ticket.id }}</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="breadcrumb-item active">{% trans "Edit Ticket" %}</li>
|
<li class="breadcrumb-item active">{% trans "Edit Ticket" %}</li>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block helpdesk_body %}
|
{% block helpdesk_body %}
|
||||||
<div class="col-xs-6">
|
<div class="col-xs-6">
|
||||||
<div class="panel panel-default">
|
<div class="panel panel-default">
|
||||||
|
<div class="panel-body"><h2>{% trans "Edit a Ticket" %}</h2>
|
||||||
<div class="panel-body"><h2>{% trans "Edit a Ticket" %}</h2>
|
<p>
|
||||||
|
{% trans "Unless otherwise stated, all fields are required." %}
|
||||||
<p>{% trans "Unless otherwise stated, all fields are required." %} {% trans "Please provide as descriptive a title and description as possible." %}</p>
|
{% trans "Please provide as descriptive a title and description as possible." %}
|
||||||
|
</p>
|
||||||
<p><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>
|
<p>
|
||||||
|
<strong>{% trans "Note" %}:</strong>
|
||||||
<form method='post' action='./'>
|
{% 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 %}
|
||||||
<fieldset>
|
</p>
|
||||||
{{ form|bootstrap4form }}
|
<form method='post'>
|
||||||
{% comment %}
|
{% csrf_token %}
|
||||||
{% for field in form %}
|
<fieldset>
|
||||||
{% if field.is_hidden %}
|
{{ form|bootstrap4form }}
|
||||||
{{ field }}
|
<div class='buttons form-group'>
|
||||||
{% else %}
|
<input type='submit' class="btn btn-primary btn-sm" value='{% trans "Save Changes" %}'/>
|
||||||
<dt><label for='id_{{ field.name }}'>{{ field.label }}</label>{% if not field.field.required %} <span class='form_optional'>{% trans "(Optional)" %}</span>{% endif %}</dt>
|
<a href='{{ ticket.get_absolute_url }}'>
|
||||||
<dd>{{ field }}</dd>
|
<button class="btn btn-danger">{% trans "Cancel Changes" %}</button>
|
||||||
{% if field.errors %}<dd class='error'>{{ field.errors }}</dd>{% endif %}
|
</a>
|
||||||
{% if field.help_text %}<dd class='form_help_text'>{{ field.help_text }}</dd>{% endif %}</label>
|
</div>
|
||||||
{% endif %}
|
</fieldset>
|
||||||
{% endfor %}
|
</form>
|
||||||
</dl>
|
</div>
|
||||||
{% endcomment %}
|
</div>
|
||||||
<div class='buttons form-group'>
|
|
||||||
<input type='submit' class="btn btn-primary btn-sm" value='{% trans "Save Changes" %}' />
|
|
||||||
<a href='{{ ticket.get_absolute_url }}'><button class="btn btn-danger">{% trans "Cancel Changes" %}</button></a>
|
|
||||||
</div>
|
</div>
|
||||||
</fieldset>
|
{% endblock %}
|
||||||
|
|
||||||
{% csrf_token %}</form>
|
{% block helpdesk_js %}
|
||||||
</div>
|
<script>
|
||||||
</div>
|
$(() => {
|
||||||
</div>
|
$("#id_due_date").datepicker({dateFormat: 'yy-mm-dd'});
|
||||||
|
})
|
||||||
<script>
|
</script>
|
||||||
$( function() {
|
|
||||||
$( "#id_due_date" ).datepicker({dateFormat: 'yy-mm-dd'});
|
|
||||||
} );
|
|
||||||
</script>
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -1213,13 +1213,10 @@ def edit_ticket(request, ticket_id):
|
|||||||
ticket = get_object_or_404(Ticket, id=ticket_id)
|
ticket = get_object_or_404(Ticket, id=ticket_id)
|
||||||
ticket_perm_check(request, ticket)
|
ticket_perm_check(request, ticket)
|
||||||
|
|
||||||
if request.method == 'POST':
|
form = EditTicketForm(request.POST or None, instance=ticket)
|
||||||
form = EditTicketForm(request.POST, instance=ticket)
|
if form.is_valid():
|
||||||
if form.is_valid():
|
ticket = form.save()
|
||||||
ticket = form.save()
|
return redirect(ticket)
|
||||||
return HttpResponseRedirect(ticket.get_absolute_url())
|
|
||||||
else:
|
|
||||||
form = EditTicketForm(instance=ticket)
|
|
||||||
|
|
||||||
return render(request, 'helpdesk/edit_ticket.html', {'form': form, 'ticket': ticket})
|
return render(request, 'helpdesk/edit_ticket.html', {'form': form, 'ticket': ticket})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user