mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2025-08-18 03:40:02 +02:00
Implement ticket merge feature in ticket list. Create intermediate page to choose which data and custom field values to keep on the main ticket.
Also add new template tag filter to use the dictionary get function in template.
This commit is contained in:
@@ -8,7 +8,7 @@ forms.py - Definitions of newforms-based forms for creating and maintaining
|
||||
"""
|
||||
import logging
|
||||
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.core.exceptions import ObjectDoesNotExist, ValidationError
|
||||
from django import forms
|
||||
from django.conf import settings
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
@@ -510,3 +510,19 @@ class TicketDependencyForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = TicketDependency
|
||||
exclude = ('ticket',)
|
||||
|
||||
|
||||
class MultipleTicketSelectForm(forms.Form):
|
||||
tickets = forms.ModelMultipleChoiceField(
|
||||
label=_('Tickets to merge'),
|
||||
queryset=Ticket.objects.all(),
|
||||
widget=forms.SelectMultiple(attrs={'class': 'form-control'})
|
||||
)
|
||||
|
||||
def clean_tickets(self):
|
||||
tickets = self.cleaned_data.get('tickets')
|
||||
if len(tickets) < 2:
|
||||
raise ValidationError(_('Please choose at least 2 tickets'))
|
||||
if len(tickets) > 4:
|
||||
raise ValidationError(_('Impossible to merge more than 4 tickets...'))
|
||||
return tickets
|
||||
|
Reference in New Issue
Block a user