def get_context_data(self, **kwargs): context = super(BaseStaffDashboardView, self).get_context_data(**kwargs) project_dict = OrderedDict() project_dict[ProjectGroup('Proposed Projects', "proposed")] = Project.objects.get_proposed( *self.get_filter_args()) project_dict[ProjectGroup( 'Staged projects', "staged")] = Project.objects.get_staged(*self.get_filter_args()) project_dict[ProjectGroup( 'Active Projects', "active")] = Project.objects.get_active(*self.get_filter_args()) project_dict[ProjectGroup( 'Completed Projects', "completed")] = Project.objects.get_completed( *self.get_filter_args()) context["project_dict"] = project_dict context["role"] = self.role or "donor" context['donated_projects'] = Project.objects.donated_projects( self.user_profile) statistics_dictionary = aggregate_stats(self.user_profile) statistics_dictionary['total_donated'] = total_donations() statistics_dictionary['people_served'] = Project.objects.aggregate( n=Sum('people_affected'))['n'] humanize_integers(statistics_dictionary) context['statistics'] = statistics_dictionary return context
def get_context_data(self, **kwargs): context = super(BaseStaffDashboardView, self).get_context_data(**kwargs) project_dict = OrderedDict() project_dict[ProjectGroup('Proposed Projects', "proposed")] = Project.objects.get_proposed( *self.get_filter_args()) project_dict[ProjectGroup( 'Staged projects', "staged")] = Project.objects.get_staged(*self.get_filter_args()) project_dict[ProjectGroup( 'Active Projects', "active")] = Project.objects.get_active(*self.get_filter_args()) project_dict[ProjectGroup( 'Completed Projects', "completed")] = Project.objects.get_completed( *self.get_filter_args()) context["project_dict"] = project_dict context["role"] = self.role or "donor" context['donated_projects'] = Project.objects.donated_projects( self.user_profile) statistics_dictionary = aggregate_stats(self.user_profile) context['statistics'] = statistics_dictionary context['category_setter_url'] = reverse('dashboard_category_setter') context['categories'] = Category.objects.all().order_by('title') context[ 'preferred_categories'] = self.user_profile.preferred_categories.all( ) # TODO (noah): add in support for autoshowing a project based on the active_project GET parameter return context
def get_context_data(self, **kwargs): context = super(DonorDashboardView, self).get_context_data(**kwargs) project_dict = {} project_dict[ProjectGroup('My Projects', "donated")] = Project.objects.donated_projects(self.user_profile) context["project_dict"] = project_dict active = Project.objects.get_active() context["first_project"] = active[0] if active.count() > 0 else None context["role"] = "donor" context["donor_has_no_donated_projects"] = Project.objects.donated_projects(self.user_profile).count() == 0 context['donated_projects'] = Project.objects.donated_projects(self.user_profile) statistics_dictionary = aggregate_stats(self.user_profile) statistics_dictionary['total_donated'] = total_donations(self.user_profile) statistics_dictionary['people_served'] = Project.objects.aggregate(n=Sum('people_affected'))['n'] humanize_integers(statistics_dictionary) context['statistics'] = statistics_dictionary context['category_setter_url'] = reverse('dashboard_category_setter') context['categories'] = Category.objects.all().order_by('title') context['preferred_categories'] = self.user_profile.preferred_categories.all() return context
def get_context_data(self, **kwargs): context = super(BaseStaffDashboardView, self).get_context_data(**kwargs) project_dict = OrderedDict() project_dict[ProjectGroup("Proposed Projects", "proposed")] = Project.objects.get_proposed( *self.get_filter_args() ) project_dict[ProjectGroup("Staged projects", "staged")] = Project.objects.get_staged(*self.get_filter_args()) project_dict[ProjectGroup("Active Projects", "active")] = Project.objects.get_active(*self.get_filter_args()) project_dict[ProjectGroup("Completed Projects", "completed")] = Project.objects.get_completed( *self.get_filter_args() ) context["project_dict"] = project_dict context["role"] = self.role or "donor" context["donated_projects"] = Project.objects.donated_projects(self.user_profile) statistics_dictionary = aggregate_stats(self.user_profile) context["statistics"] = statistics_dictionary context["category_setter_url"] = reverse("dashboard_category_setter") context["categories"] = Category.objects.all().order_by("title") context["preferred_categories"] = self.user_profile.preferred_categories.all() # TODO (noah): add in support for autoshowing a project based on the active_project GET parameter return context
def get_context_data(self, **kwargs): context = super(DonorDashboardView, self).get_context_data(**kwargs) project_dict = {} project_dict[ProjectGroup( 'My Projects', "donated")] = Project.objects.donated_projects(self.user_profile) context["project_dict"] = project_dict active = Project.objects.get_active() context["first_project"] = active[0] if active.count() > 0 else None context["role"] = "donor" context["donated_amount"] = self.request.session.get('amount') context["donated_project"] = self.request.session.get('project') context["cover_photo"] = self.request.session.get('cover_photo') context["url"] = self.request.session.get('url') context["social"] = self.request.session.get('social') if self.request.session.get('social'): del self.request.session['social'] context["donor_has_no_donated_projects"] = Payment.objects.filter( user=self.user_profile).count() == 0 context['donated_projects'] = Project.objects.donated_projects( self.user_profile) statistics_dictionary = aggregate_stats(self.user_profile) statistics_dictionary['total_donated'] = total_donations( self.user_profile) total_people_affected = Project.objects.donated_completed_projects( self.user_profile) statistics_dictionary['people_served'] = total_people_affected humanize_integers(statistics_dictionary) admin_reinvestment = \ Payment.objects.filter(user=self.user_profile).filter(admin_reinvestment__isnull=False).aggregate( Sum('amount'))[ 'amount__sum'] or 0 user_reinvestment = UserReinvestment.objects.filter( user=self.user_profile).aggregate( Sum('amount'))['amount__sum'] or 0 statistics_dictionary[ 'reinvestment'] = admin_reinvestment + user_reinvestment context['statistics'] = statistics_dictionary amount = self.user_profile.reinvest_pool + self.user_profile.solar_seed_fund_pool if self.user_profile and amount > 0.0: context[ "reinvestment_amount"] = self.user_profile.reinvest_pool + self.user_profile.solar_seed_fund_pool else: context["reinvestment_amount"] = 0.0 # context['category_setter_url'] = reverse('dashboard_category_setter') # context['categories'] = Category.objects.all().order_by('title') # context['preferred_categories'] = self.user_profile.preferred_categories.all() return context
def get_context_data(self, **kwargs): context = super(DonorDashboardView, self).get_context_data(**kwargs) project_dict = {} project_dict[ProjectGroup('My Projects', "donated")] = Project.objects.donated_projects(self.user_profile) context["project_dict"] = project_dict active = Project.objects.get_active() context["first_project"] = active[0] if active.count() > 0 else None context["role"] = "donor" context["donated_amount"] = self.request.session.get('amount') context["donated_project"] = self.request.session.get('project') context["cover_photo"] = self.request.session.get('cover_photo') context["url"] = self.request.session.get('url') context["social"] = self.request.session.get('social') if self.request.session.get('social'): del self.request.session['social'] context["donor_has_no_donated_projects"] = Payment.objects.filter(user=self.user_profile).count() == 0 context['donated_projects'] = Project.objects.donated_projects(self.user_profile) statistics_dictionary = aggregate_stats(self.user_profile) statistics_dictionary['total_donated'] = total_donations(self.user_profile) total_people_affected = Project.objects.donated_completed_projects(self.user_profile) statistics_dictionary['people_served'] = total_people_affected humanize_integers(statistics_dictionary) admin_reinvestment = \ Payment.objects.filter(user=self.user_profile).filter(admin_reinvestment__isnull=False).aggregate( Sum('amount'))[ 'amount__sum'] or 0 user_reinvestment = UserReinvestment.objects.filter(user=self.user_profile).aggregate(Sum('amount'))[ 'amount__sum'] or 0 statistics_dictionary['reinvestment'] = admin_reinvestment + user_reinvestment context['statistics'] = statistics_dictionary amount = self.user_profile.reinvest_pool + self.user_profile.solar_seed_fund_pool if self.user_profile and amount > 0.0: context["reinvestment_amount"] = self.user_profile.reinvest_pool + self.user_profile.solar_seed_fund_pool else: context["reinvestment_amount"] = 0.0 # context['category_setter_url'] = reverse('dashboard_category_setter') # context['categories'] = Category.objects.all().order_by('title') # context['preferred_categories'] = self.user_profile.preferred_categories.all() return context
def get_context_data(self, **kwargs): context = super(BaseStaffDashboardView, self).get_context_data(**kwargs) project_dict = OrderedDict() project_dict[ProjectGroup('Proposed Projects', "proposed")] = Project.objects.get_proposed(*self.get_filter_args()) project_dict[ProjectGroup('Staged projects', "staged")] = Project.objects.get_staged(*self.get_filter_args()) project_dict[ProjectGroup('Active Projects', "active")] = Project.objects.get_active(*self.get_filter_args()) project_dict[ProjectGroup('Completed Projects', "completed")] = Project.objects.get_completed(*self.get_filter_args()) context["project_dict"] = project_dict context["role"] = self.role or "donor" context['donated_projects'] = Project.objects.donated_projects(self.user_profile) statistics_dictionary = aggregate_stats(self.user_profile) statistics_dictionary['total_donated'] = total_donations(self.user_profile) statistics_dictionary['people_served'] = Project.objects.aggregate(n=Sum('people_affected'))['n'] humanize_integers(statistics_dictionary) context['statistics'] = statistics_dictionary return context
def get_context_data(self, **kwargs): context = super(DonorDashboardView, self).get_context_data(**kwargs) project_dict = {} project_dict[ProjectGroup('My Projects', "donated")] = Project.objects.donated_projects(self.user_profile) context["project_dict"] = project_dict active = Project.objects.get_active() context["first_project"] = active[0] if active.count() > 0 else None context["role"] = "donor" context["donor_has_no_donated_projects"] = Project.objects.donated_projects(self.user_profile).count() == 0 context['donated_projects'] = Project.objects.donated_projects(self.user_profile) statistics_dictionary = aggregate_stats(self.user_profile) context['statistics'] = statistics_dictionary context['category_setter_url'] = reverse('dashboard_category_setter') context['categories'] = Category.objects.all().order_by('title') context['preferred_categories'] = self.user_profile.preferred_categories.all() return context