diff --git a/app/grants/admin.py b/app/grants/admin.py index 5f4bd1c973e..45904d51029 100644 --- a/app/grants/admin.py +++ b/app/grants/admin.py @@ -96,18 +96,23 @@ class GrantAdmin(GeneralAdmin): 'link', 'clr_prediction_curve', 'hidden', 'next_clr_calc_date', 'last_clr_calc_date', 'metadata', 'twitter_handle_1', 'twitter_handle_2', 'view_count', 'is_clr_eligible', 'in_active_clrs', 'last_update', 'funding_info', 'twitter_verified', 'twitter_verified_by', 'twitter_verified_at', 'stats_history', - 'zcash_payout_address', 'celo_payout_address','zil_payout_address' + 'zcash_payout_address', 'celo_payout_address','zil_payout_address', 'emails' ] readonly_fields = [ 'logo_svg_asset', 'logo_asset', 'team_member_list', 'clr_prediction_curve', 'subscriptions_links', 'contributions_links', 'link', 'migrated_to', 'view_count', 'in_active_clrs', 'stats_history', + 'emails' ] list_display =['pk', 'sybil_score', 'weighted_risk_score', 'match_amount', 'positive_round_contributor_count', 'is_clr_eligible', 'title', 'active', 'link', 'hidden', 'migrated_to'] raw_id_fields = ['admin_profile', 'twitter_verified_by'] search_fields = ['description', 'admin_profile__handle'] + def get_queryset(self, request): + qs = super(GrantAdmin, self).get_queryset(request) + self.request = request + return qs # Custom Avatars def logo_svg_asset(self, instance): @@ -116,6 +121,13 @@ def logo_svg_asset(self, instance): return mark_safe(f'') return mark_safe('N/A') + def emails(self, instance): + emails = [] + emails.append(instance.admin_profile.email) + for profile in instance.team_members.all(): + emails.append(profile.email) + return ",".join(emails) + def view_count(self, instance): return instance.get_view_count @@ -148,6 +160,9 @@ def logo_asset(self, instance): return mark_safe('N/A') def subscriptions_links(self, instance): + if not self.request.GET.get('show_data'): + return mark_safe(f"Show data") + """Define the logo image tag to be displayed in the admin.""" eles = [] # todo: figure out how to set request @@ -168,6 +183,8 @@ def response_change(self, request, obj): return redirect(obj.admin_url) def contributions_links(self, instance): + if not self.request.GET.get('show_data'): + return mark_safe(f"Show data") """Define the logo image tag to be displayed in the admin.""" eles = [] @@ -190,6 +207,8 @@ def migrated_to(self, instance): return mark_safe(html) def stats_history(self, instance): + if not self.request.GET.get('show_data'): + return mark_safe(f"Show data") html = "" html += "" for ele in instance.stats.filter(snapshot_type='increment').order_by('-created_on'):
DateImpressionsCart AdditionsContributions