From 41dc93198d55ece545a470098b6aca8db9c9eeed 2015-08-03 12:59:44 From: Patrick Altman Date: 2015-08-03 12:59:44 Subject: [PATCH] Merge pull request #88 from miurahr/sponsorship-admin-contacts admin contact --- diff --git a/symposion/sponsorship/admin.py b/symposion/sponsorship/admin.py index b64c1a132169214e187eec8e80eb625153a476b1..77a84b8da7d2b0179db6986d291be6fb3101d5a6 100644 --- a/symposion/sponsorship/admin.py +++ b/symposion/sponsorship/admin.py @@ -1,4 +1,7 @@ from django.contrib import admin +from django.utils.html import escape +from django.utils.safestring import mark_safe +from django.utils.translation import ugettext_lazy as _ from symposion.sponsorship.models import SponsorLevel, Sponsor, Benefit, BenefitLevel, \ SponsorBenefit @@ -43,7 +46,16 @@ class SponsorAdmin(admin.ModelAdmin): }) ] inlines = [SponsorBenefitInline] - list_display = ["name", "external_url", "level", "active"] + list_display = ["name", "external_url", "level", "active", "contact", "applicant_field"] + + def contact(self, sponsor): + return mark_safe('%s' % (escape(sponsor.contact_email), escape(sponsor.contact_name))) + + def applicant_field(self, sponsor): + name = sponsor.applicant.get_full_name() + email = sponsor.applicant.email + return mark_safe('%s' % (escape(email), escape(name))) + applicant_field.short_description = _(u"Applicant") def get_form(self, *args, **kwargs): # @@@ kinda ugly but using choices= on NullBooleanField is broken