mirror of
https://github.com/django-helpdesk/django-helpdesk.git
synced 2024-12-12 18:00:45 +01:00
Only show open ticket as dependency/parent candidates
It makes no sense to make a ticket depend on an already closed ticket, or to make a closed ticket depend on another. The only case I can think of is to create such a relationship in hindsight for documentation purposes. This can be implemented by adding an admin interface or giving the administrator more choices.
This commit is contained in:
parent
7bf21685b3
commit
2cb9d382cb
@ -594,8 +594,8 @@ class TicketDependencyForm(forms.ModelForm):
|
|||||||
def __init__(self, ticket, *args, **kwargs):
|
def __init__(self, ticket, *args, **kwargs):
|
||||||
super(TicketDependencyForm,self).__init__(*args, **kwargs)
|
super(TicketDependencyForm,self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
# Exclude duplicate tickets, myself, existing dependencies and parents
|
# Only open tickets except myself, existing dependencies and parents
|
||||||
self.fields['depends_on'].queryset = Ticket.objects.exclude(status=Ticket.DUPLICATE_STATUS).exclude(id=ticket.id).exclude(depends_on__ticket=ticket).exclude(ticketdependency__depends_on=ticket)
|
self.fields['depends_on'].queryset = Ticket.objects.filter(status__in=Ticket.OPEN_STATUSES).exclude(id=ticket.id).exclude(depends_on__ticket=ticket).exclude(ticketdependency__depends_on=ticket)
|
||||||
|
|
||||||
class TicketResolvesForm(forms.ModelForm):
|
class TicketResolvesForm(forms.ModelForm):
|
||||||
''' Adds this ticket as a dependency for a different ticket '''
|
''' Adds this ticket as a dependency for a different ticket '''
|
||||||
@ -608,8 +608,8 @@ class TicketResolvesForm(forms.ModelForm):
|
|||||||
def __init__(self, ticket, *args, **kwargs):
|
def __init__(self, ticket, *args, **kwargs):
|
||||||
super(TicketResolvesForm,self).__init__(*args, **kwargs)
|
super(TicketResolvesForm,self).__init__(*args, **kwargs)
|
||||||
|
|
||||||
# Exclude duplicate tickets, myself, existing dependencies and parents
|
# Only open tickets except myself, existing dependencies and parents
|
||||||
self.fields['ticket'].queryset = Ticket.objects.exclude(status=Ticket.DUPLICATE_STATUS).exclude(id=ticket.id).exclude(depends_on__ticket=ticket).exclude(ticketdependency__depends_on=ticket)
|
self.fields['ticket'].queryset = Ticket.objects.exclude(status__in=Ticket.OPEN_STATUSES).exclude(id=ticket.id).exclude(depends_on__ticket=ticket).exclude(ticketdependency__depends_on=ticket)
|
||||||
|
|
||||||
|
|
||||||
class MultipleTicketSelectForm(forms.Form):
|
class MultipleTicketSelectForm(forms.Form):
|
||||||
|
Loading…
Reference in New Issue
Block a user