jumpserver/apps/tickets/mixins.py

17 lines
485 B
Python
Raw Normal View History

2019-11-08 07:48:01 +00:00
# -*- coding: utf-8 -*-
#
from django.db.models import Q
2019-11-18 10:44:21 +00:00
from .models import Ticket
2019-11-08 07:48:01 +00:00
class TicketMixin:
def get_queryset(self):
assign = self.request.GET.get('assign', None)
if assign is None:
2019-11-18 10:44:21 +00:00
queryset = Ticket.get_related_tickets(self.request.user)
2019-11-08 07:48:01 +00:00
elif assign in ['1']:
2019-11-18 10:44:21 +00:00
queryset = Ticket.get_assigned_tickets(self.request.user)
2019-11-08 07:48:01 +00:00
else:
2019-11-18 10:44:21 +00:00
queryset = Ticket.get_my_tickets(self.request.user)
2019-11-08 07:48:01 +00:00
return queryset