You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
jumpserver/apps/tickets/mixins.py

18 lines
557 B

# -*- coding: utf-8 -*-
#
from django.db.models import Q
from .models import Ticket
class TicketMixin:
def get_queryset(self):
queryset = super().get_queryset()
assign = self.request.GET.get('assign', None)
if assign is None:
queryset = Ticket.get_related_tickets(self.request.user, queryset)
elif assign in ['1']:
queryset = Ticket.get_assigned_tickets(self.request.user, queryset)
else:
queryset = Ticket.get_my_tickets(self.request.user, queryset)
return queryset