def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) is_staff = self.request.user.is_staff context['show_pdf'] = self.request.user.profile.should_see_pdf() context['body_class'] = 'admin' if is_staff: context['ALL_TAG_NAMES'] = TagsService.get_all_used_tag_names() context['results'] = \ SubmissionsService.get_submissions_for_followups( self.request.GET.get('page')) context['app_index_tabs'], count = get_tabs_for_staff_user( 'All Applications') context['app_index_scope_title'] = 'Applications' else: context['results'] = \ AppsService.get_all_applications_for_org_user( self.request.user, self.request.GET.get('page')) context['app_index_tabs'], count = get_tabs_for_org_user( self.request.user.profile.organization, 'All') context['app_index_scope_title'] = "All Applications To {}".format( self.request.user.profile.organization.name) if count == 0: context['no_results'] = 'You have no applications.' context['csv_download_link'] = None else: context['csv_download_link'] = reverse('intake-csv_download') context['page_counter'] = \ utils.get_page_navigation_counter( page=context['results'], wing_size=9) return context
def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) is_staff = self.request.user.is_staff context['show_pdf'] = self.request.user.profile.should_see_pdf() context['body_class'] = 'admin' if is_staff: context['ALL_TAG_NAMES'] = TagsService.get_all_used_tag_names() context['results'] = \ SubmissionsService.get_submissions_for_followups( self.request.GET.get('page')) context['app_index_tabs'], count = get_tabs_for_staff_user( 'All Applications') context['app_index_scope_title'] = 'Applications' else: context['results'] = \ AppsService.get_all_applications_for_org_user( self.request.user, self.request.GET.get('page')) context['app_index_tabs'], count = get_tabs_for_org_user( self.request.user.profile.organization, 'All') context['app_index_scope_title'] = "All Applications To {}".format( self.request.user.profile.organization.name) if count == 0: context['no_results'] = 'You have no applications.' context['csv_download_link'] = None else: context['csv_download_link'] = reverse('intake-csv_download') context['page_counter'] = \ utils.get_page_navigation_counter( page=context['results'], wing_size=9) return context
def test_returns_used_tags(self): tag = mock.make_tag("example") sub = mock.make_submission() user = create_user() link = SubmissionTagLink(user=user, content_object=sub, tag=tag) link.save() results = TagsService.get_all_used_tag_names() self.assertEqual(list(results), ["example"])
def get_context_data(self, **kwargs): is_staff = self.request.user.is_staff context = super().get_context_data(**kwargs) context['submissions'] = \ SubmissionsService.get_permitted_submissions( self.request.user, related_objects=True) # context['page_counter'] = \ # utils.get_page_navigation_counter( # page=context['submissions'], # wing_size=9) context['show_pdf'] = self.request.user.profile.should_see_pdf() context['body_class'] = 'admin' if is_staff: context['ALL_TAG_NAMES'] = TagsService.get_all_used_tag_names() return context
def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) is_staff = self.request.user.is_staff context['show_pdf'] = self.request.user.profile.should_see_pdf() context['body_class'] = 'admin' context['search_form'] = forms.ApplicationSelectForm() if is_staff: context['ALL_TAG_NAMES'] = TagsService.get_all_used_tag_names() context['results'] = \ SubmissionsService.get_submissions_for_followups() else: context['results'] = \ AppsService.get_applications_index_for_org_user( self.request.user, self.request.GET.get('page')) context['page_counter'] = \ utils.get_page_navigation_counter( page=context['results'], wing_size=9) return context
def get_context_data(self, **kwargs): context = super().get_context_data(**kwargs) is_staff = self.request.user.is_staff context['show_pdf'] = self.request.user.profile.should_see_pdf() context['body_class'] = 'admin' if is_staff: context['ALL_TAG_NAMES'] = TagsService.get_all_used_tag_names() context['results'] = \ SubmissionsService.get_submissions_for_followups( self.request.GET.get('page')) else: context['results'] = \ AppsService.get_applications_index_for_org_user( self.request.user, self.request.GET.get('page')) context['page_counter'] = \ utils.get_page_navigation_counter( page=context['results'], wing_size=9) return context
def test_doesnt_return_unused_tags(self): mock.make_tag() results = TagsService.get_all_used_tag_names() self.assertEqual(list(results), [])