mirror of https://github.com/jumpserver/jumpserver
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.
19 lines
568 B
19 lines
568 B
5 years ago
|
# -*- coding: utf-8 -*-
|
||
|
#
|
||
|
from django.db.models import Q
|
||
|
|
||
|
|
||
|
class TicketMixin:
|
||
|
def get_queryset(self):
|
||
|
queryset = super().get_queryset()
|
||
|
assign = self.request.GET.get('assign', None)
|
||
|
if assign is None:
|
||
|
queryset = queryset.filter(
|
||
|
Q(assignees=self.request.user) | Q(user=self.request.user)
|
||
|
).distinct()
|
||
|
elif assign in ['1']:
|
||
|
queryset = queryset.filter(assignees=self.request.user)
|
||
|
else:
|
||
|
queryset = queryset.filter(user=self.request.user)
|
||
|
return queryset
|