mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2025-08-18 11:49:56 +02:00
dropdown works for assign
This commit is contained in:
@@ -73,9 +73,31 @@
|
|||||||
<td>{{ ticket.created|date:"DATETIME_FORMAT" }} ({{ ticket.created|naturaltime }})</td>
|
<td>{{ ticket.created|date:"DATETIME_FORMAT" }} ({{ ticket.created|naturaltime }})</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
<!-- show current Assignee for ticket -->
|
||||||
<th class="table-active">{% trans "Assigned To" %}</th>
|
<th class="table-active">{% trans "Assigned To" %}</th>
|
||||||
<td>
|
<td>
|
||||||
|
<!-- assignment drop down -->
|
||||||
{{ ticket.get_assigned_to }}
|
{{ ticket.get_assigned_to }}
|
||||||
|
<form method="post" action="{% url 'helpdesk:mass_update' %}">
|
||||||
|
{% csrf_token %}
|
||||||
|
<input type="hidden" name="ticket_id" value="{{ ticket.id }}">
|
||||||
|
<input type="hidden" name="next" value="{% url 'helpdesk:view' ticket.id %}">
|
||||||
|
|
||||||
|
<div class="d-flex align-items-center gap-2">
|
||||||
|
<select name="action" class="form-select form-select-sm">
|
||||||
|
<option disabled selected>Assign to...</option>
|
||||||
|
{% for user in assignable_users %}
|
||||||
|
<option value="assign_{{ user.id }}" {% if ticket.assigned_to and ticket.assigned_to.id == user.id %}selected{% endif %}>
|
||||||
|
{{ user.get_full_name|default:user.username }}
|
||||||
|
</option>
|
||||||
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
<button type="submit" class="btn btn-primary btn-sm">
|
||||||
|
<i class="fas fa-user-check"></i>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
<!-- self assign hand -->
|
||||||
<a class="btn btn-primary btn-sm float-right" data-toggle="tooltip" href='?take' title='{% trans "Assign this ticket to " %}{{ request.user.email }}'>
|
<a class="btn btn-primary btn-sm float-right" data-toggle="tooltip" href='?take' title='{% trans "Assign this ticket to " %}{{ request.user.email }}'>
|
||||||
<i class="fas fa-hand-paper"></i>
|
<i class="fas fa-hand-paper"></i>
|
||||||
</a>
|
</a>
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
"""
|
"""
|
||||||
django-helpdesk - A Django powered ticket tracker for small enterprise.
|
django-helpdesk - A Django powered ticket tracker for small enterprise.
|
||||||
|
|
||||||
(c) Copyright 2008 Jutda. All Rights Reserved. See LICENSE for details.
|
(c) Copyright 2008-2025 Jutda. All Rights Reserved. See LICENSE for details.
|
||||||
|
|
||||||
views/public.py - All public facing views, eg non-staff (no authentication
|
views/public.py - All public facing views, eg non-staff (no authentication
|
||||||
required) views.
|
required) views.
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
"""
|
"""
|
||||||
django-helpdesk - A Django powered ticket tracker for small enterprise.
|
django-helpdesk - A Django powered ticket tracker for small enterprise.
|
||||||
|
|
||||||
(c) Copyright 2008 Jutda. All Rights Reserved. See LICENSE for details.
|
(c) Copyright 2008-2025 Jutda. All Rights Reserved. See LICENSE for details.
|
||||||
|
|
||||||
views/staff.py - The bulk of the application - provides most business logic and
|
views/staff.py - The bulk of the application - provides most business logic and
|
||||||
renders all staff-facing views.
|
renders all staff-facing views.
|
||||||
@@ -87,6 +87,7 @@ import helpdesk.views.abstract_views as abstract_views
|
|||||||
from helpdesk.views.permissions import MustBeStaffMixin
|
from helpdesk.views.permissions import MustBeStaffMixin
|
||||||
import json
|
import json
|
||||||
import re
|
import re
|
||||||
|
import logging
|
||||||
from rest_framework import status
|
from rest_framework import status
|
||||||
from rest_framework.decorators import api_view
|
from rest_framework.decorators import api_view
|
||||||
import typing
|
import typing
|
||||||
@@ -96,6 +97,9 @@ from django.utils.timezone import now
|
|||||||
if helpdesk_settings.HELPDESK_KB_ENABLED:
|
if helpdesk_settings.HELPDESK_KB_ENABLED:
|
||||||
from helpdesk.models import KBItem
|
from helpdesk.models import KBItem
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
DATE_RE: re.Pattern = re.compile(
|
DATE_RE: re.Pattern = re.compile(
|
||||||
r"(?P<month>\d{1,2})/(?P<day>\d{1,2})/(?P<year>\d{4})$"
|
r"(?P<month>\d{1,2})/(?P<day>\d{1,2})/(?P<year>\d{4})$"
|
||||||
)
|
)
|
||||||
@@ -473,6 +477,10 @@ def view_ticket(request, ticket_id):
|
|||||||
# add custom fields to further details panel
|
# add custom fields to further details panel
|
||||||
customfields_form = EditTicketCustomFieldForm(None, instance=ticket)
|
customfields_form = EditTicketCustomFieldForm(None, instance=ticket)
|
||||||
|
|
||||||
|
# Define users that the ticket can be assigned to
|
||||||
|
assignable_users = User.objects.filter(is_active=True).order_by('username')
|
||||||
|
logger.debug("Assignable users:", assignable_users)
|
||||||
|
|
||||||
return render(
|
return render(
|
||||||
request,
|
request,
|
||||||
"helpdesk/ticket.html",
|
"helpdesk/ticket.html",
|
||||||
@@ -488,6 +496,7 @@ def view_ticket(request, ticket_id):
|
|||||||
"SHOW_SUBSCRIBE": show_subscribe,
|
"SHOW_SUBSCRIBE": show_subscribe,
|
||||||
"checklist_form": checklist_form,
|
"checklist_form": checklist_form,
|
||||||
"customfields_form": customfields_form,
|
"customfields_form": customfields_form,
|
||||||
|
"assignable_users": assignable_users,
|
||||||
**extra_context_kwargs,
|
**extra_context_kwargs,
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
@@ -816,7 +825,9 @@ def mass_update(request):
|
|||||||
elif action == "delete":
|
elif action == "delete":
|
||||||
t.delete()
|
t.delete()
|
||||||
|
|
||||||
return HttpResponseRedirect(reverse("helpdesk:list"))
|
# Go to ticket template if from ticket or list template otherwise
|
||||||
|
next_url = request.POST.get("next") or reverse("helpdesk:list")
|
||||||
|
return HttpResponseRedirect(next_url)
|
||||||
|
|
||||||
|
|
||||||
mass_update = staff_member_required(mass_update)
|
mass_update = staff_member_required(mass_update)
|
||||||
|
Reference in New Issue
Block a user