From 2b6cc68994c47bd84133c42db52f1937e96034c6 Mon Sep 17 00:00:00 2001 From: octavioamu Date: Wed, 30 Oct 2019 16:41:05 -0300 Subject: [PATCH] fix bulk invite and query --- app/dashboard/admin.py | 16 ++++++++++++- app/dashboard/templates/dashboard/users.html | 25 ++++++++++---------- app/dashboard/views.py | 2 +- 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/app/dashboard/admin.py b/app/dashboard/admin.py index 4ef32fcfcc4..166f8912e73 100644 --- a/app/dashboard/admin.py +++ b/app/dashboard/admin.py @@ -85,8 +85,22 @@ class ToolVoteAdmin(admin.ModelAdmin): class BountyInvitesAdmin(admin.ModelAdmin): - raw_id_fields = ['bounty'] + raw_id_fields = ['bounty', 'inviter', 'invitee'] ordering = ['-id'] + readonly_fields = [ 'from_inviter', 'to_invitee'] + list_display = [ 'id', 'from_inviter', 'to_invitee', 'bounty_url'] + + def bounty_url(self, obj): + bounty = obj.bounty.first() + return format_html("{}", mark_safe(bounty.url), mark_safe(bounty.url)) + + def from_inviter(self, obj): + """Get the profile handle.""" + return "\n".join([p.username for p in obj.inviter.all()]) + + def to_invitee(self, obj): + """Get the profile handle.""" + return "\n".join([p.username for p in obj.invitee.all()]) class InterestAdmin(admin.ModelAdmin): diff --git a/app/dashboard/templates/dashboard/users.html b/app/dashboard/templates/dashboard/users.html index 8879e8382aa..71c3ee418df 100644 --- a/app/dashboard/templates/dashboard/users.html +++ b/app/dashboard/templates/dashboard/users.html @@ -65,24 +65,25 @@
- + - - - - + + + +
- + - - - - + + + + +
@@ -127,7 +128,7 @@

[[ numUsers ]] users found

- {% endif %} @@ -300,7 +301,7 @@
Invite [[numUsers]] Users to the Bounty
{% include 'shared/analytics.html' %} {% include 'shared/footer_scripts.html' %} {% include 'shared/footer.html' %} - +