'query method for access code list
:param view_kwargs:
:return:'

def query(self, view_kwargs):

    query_ = self.session.query(AccessCode)
    query_ = event_query(self, query_, view_kwargs)
    if view_kwargs.get('user_id'):
        user = safe_query(self, User, 'id', view_kwargs['user_id'], 'user_id')
        query_ = query_.join(User).filter((User.id == user.id))
    if view_kwargs.get('ticket_id'):
        ticket = safe_query(self, Ticket, 'id', view_kwargs['ticket_id'], 'ticket_id')
        query_ = AccessCode.query.filter(AccessCode.tickets.any(id=ticket.id))
    return query_
