def test_func(self): try: if settings.access_to_procedure_is_open(): return reviewer.can_delegate( reviewer.find_by_person(self.request.user.person)) except ObjectDoesNotExist: return False
def get_context_data(self, **kwargs): context = super(MandatesListView, self).get_context_data(**kwargs) phd_list = ['RESEARCH', 'SUPERVISION', 'VICE_RECTOR', 'DONE'] research_list = ['SUPERVISION', 'VICE_RECTOR', 'DONE'] supervision_list = ['VICE_RECTOR', 'DONE'] vice_rector_list = ['VICE_RECTOR', 'DONE'] current_reviewer = reviewer.find_by_person(self.request.user.person) can_delegate = reviewer.can_delegate(current_reviewer) context['can_delegate'] = can_delegate context['reviewer'] = current_reviewer entity = entity_version.get_last_version(current_reviewer.entity) context['entity'] = entity context['phd_list'] = phd_list context['research_list'] = research_list context['supervision_list'] = supervision_list context['vice_rector_list'] = vice_rector_list context['is_supervisor'] = self.is_supervisor context['filter'] = self.kwargs.get("filter", None) context['year'] = academic_year.find_academic_year_by_id( self.request.session.get('selected_academic_year')).year start_date = academic_year.find_academic_year_by_id( int(self.request.session.get('selected_academic_year'))).start_date for mandate in context['object_list']: entities = [] entities_id = mandate.mandateentity_set.all().order_by('id') for entity in entities_id: current_entityversion = entity_version.get_by_entity_and_date( entity.entity, start_date)[0] if current_entityversion is None: current_entityversion = entity_version.get_last_version( entity.entity) entities.append(current_entityversion) mandate.entities = entities return context
def get_context_data(self, **kwargs): context = super(AssistantsListView, self).get_context_data(**kwargs) context['year'] = academic_year.current_academic_year().year start_date = academic_year.current_academic_year().start_date context['is_reviewer'] = self.is_reviewer context['current_reviewer'] = self.reviewer if self.reviewer: entity = entity_version.get_last_version(self.reviewer.entity) else: entity = None context['entity'] = entity if self.is_reviewer: can_delegate = reviewer.can_delegate( reviewer.find_by_person(self.request.user.person)) context['can_delegate'] = can_delegate else: context['can_delegate'] = False for mandate in context['object_list']: entities = [] entities_id = mandate.mandateentity_set.all().order_by('id') for entity in entities_id: current_entityversion = entity_version.get_by_entity_and_date( entity.entity, start_date)[0] if current_entityversion is None: current_entityversion = entity_version.get_last_version( entity.entity) entities.append(current_entityversion) mandate.entities = entities return context
def get_context_data(self, **kwargs): context = super(AssistantsListView, self).get_context_data(**kwargs) context['year'] = academic_year.current_academic_year().year context['current_reviewer'] = self.reviewer if self.reviewer: can_delegate = reviewer.can_delegate(reviewer.find_by_person(self.request.user.person)) context['can_delegate'] = can_delegate else: context['can_delegate'] = False return add_entities_version_to_mandates_list(context)
def get_context_data(self, **kwargs): context = super(AssistantsListView, self).get_context_data(**kwargs) context['year'] = academic_year.current_academic_year().year context['current_reviewer'] = self.reviewer if self.reviewer: can_delegate = reviewer.can_delegate(reviewer.find_by_person(self.request.user.person)) context['can_delegate'] = can_delegate else: context['can_delegate'] = False return add_entities_version_to_mandates_list(context)
def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) context['year'] = academic_year.starting_academic_year().year reviewers = reviewer.find_by_person(self.request.user.person) context['current_reviewer'] = reviewers.first() if reviewers: context['can_delegate'] = any( reviewer.can_delegate(rev) for rev in reviewers) else: context['can_delegate'] = False return add_entities_version_to_mandates_list(context)
def get_context_data(self, **kwargs): context = super(MandatesListView, self).get_context_data(**kwargs) current_reviewer = reviewer.find_by_person(self.request.user.person) can_delegate = reviewer.can_delegate(current_reviewer) context['can_delegate'] = can_delegate context['reviewer'] = current_reviewer entity = entity_version.get_last_version(current_reviewer.entity) context['entity'] = entity context['is_supervisor'] = self.is_supervisor context['review_status'] = review_status context['filter'] = self.kwargs.get("filter", None) context['year'] = academic_year.find_academic_year_by_id( self.request.session.get('selected_academic_year')).year context = add_entities_version_to_mandates_list(context) return add_actions_to_mandates_list(context, current_reviewer)
def get_context_data(self, **kwargs): context = super(MandatesListView, self).get_context_data(**kwargs) current_reviewer = reviewer.find_by_person(self.request.user.person) can_delegate = reviewer.can_delegate(current_reviewer) context['can_delegate'] = can_delegate context['reviewer'] = current_reviewer entity = entity_version.get_last_version(current_reviewer.entity) context['entity'] = entity context['is_supervisor'] = self.is_supervisor context['review_status'] = review_status context['review_advice_choices'] = review_advice_choices context['filter'] = self.kwargs.get("filter", None) context['year'] = academic_year.find_academic_year_by_id( self.request.session.get('selected_academic_year')).year context = add_entities_version_to_mandates_list(context) return add_actions_to_mandates_list(context, current_reviewer)
def get_context_data(self, **kwargs): context = super(AssistantsListView, self).get_context_data(**kwargs) context['year'] = academic_year.current_academic_year().year context['is_reviewer'] = self.is_reviewer context['current_reviewer'] = self.reviewer if self.reviewer: entity = entity_version.get_last_version(self.reviewer.entity) else: entity = None context['entity'] = entity if self.is_reviewer: can_delegate = reviewer.can_delegate( reviewer.find_by_person(self.request.user.person)) context['can_delegate'] = can_delegate else: context['can_delegate'] = False return context
def get_context_data(self, **kwargs): context = super(MandatesListView, self).get_context_data(**kwargs) phd_list = ['RESEARCH', 'SUPERVISION', 'VICE_RECTOR', 'DONE'] research_list = ['SUPERVISION', 'VICE_RECTOR', 'DONE'] supervision_list = ['VICE_RECTOR', 'DONE'] vice_rector_list = ['VICE_RECTOR', 'DONE'] current_reviewer = reviewer.find_by_person(self.request.user.person) can_delegate = reviewer.can_delegate(current_reviewer) context['can_delegate'] = can_delegate context['reviewer'] = current_reviewer entity = entity_version.get_last_version(current_reviewer.entity) context['entity'] = entity context['phd_list'] = phd_list context['research_list'] = research_list context['supervision_list'] = supervision_list context['vice_rector_list'] = vice_rector_list context['is_supervisor'] = self.is_supervisor context['filter'] = self.kwargs.get("filter", None) context['year'] = academic_year.find_academic_year_by_id( self.request.session.get('selected_academic_year')).year return add_entities_version_to_mandates_list(context)
def test_daf_can_delegate(self): self.assertTrue(reviewer.can_delegate(self.reviewer4))
def test_daf_assistant_cannot_delegate(self): self.assertFalse(reviewer.can_delegate(self.reviewer5))
def test_can_delegate(self): self.assertFalse(reviewer.can_delegate(self.reviewer1)) self.assertTrue(reviewer.can_delegate(self.reviewer2))
def test_daf_can_delegate(self): self.assertTrue(reviewer.can_delegate(self.reviewer4))
def test_daf_assistant_cannot_delegate(self): self.assertFalse(reviewer.can_delegate(self.reviewer5))
def test_can_delegate(self): self.assertFalse(reviewer.can_delegate(self.reviewer1)) self.assertTrue(reviewer.can_delegate(self.reviewer2))
def test_vice_rector_assistant_can_delegate(self): self.assertTrue(reviewer.can_delegate(self.reviewer6))