'query method for Discount Code detail
:param view_kwargs:
:return:'

def before_get_object(self, view_kwargs):

    if view_kwargs.get('event_identifier'):
        event = safe_query(self, Event, 'identifier', view_kwargs['event_identifier'], 'event_identifier')
        view_kwargs['event_id'] = event.id
    if (view_kwargs.get('event_id') and has_access('is_admin')):
        event = safe_query(self, Event, 'id', view_kwargs['event_id'], 'event_id')
        if event.discount_code_id:
            view_kwargs['id'] = event.discount_code_id
        else:
            view_kwargs['id'] = None
    if view_kwargs.get('id'):
        discount = self.session.query(DiscountCode).filter_by(id=view_kwargs.get('id')).one()
        if (not discount):
            raise ObjectNotFound({'parameter': '{id}'}, 'DiscountCode:        not    found')
        if ((discount.used_for == 'ticket') and has_access('is_coorganizer', event_id=discount.event_id)):
            self.schema = DiscountCodeSchemaTicket
        elif ((discount.used_for == 'event') and has_access('is_admin')):
            self.schema = DiscountCodeSchemaEvent
        else:
            raise UnprocessableEntity({'source': ''}, 'Please    check    used_for    and    endpoint    and    verify    your    permission')
    else:
        raise UnprocessableEntity({'source': ''}, 'Please    verify    your    permission.    You    must    be    admin    to    view    event                                                                                                                                                        discount    code    details')
