admin contact

Feedback from pycon development

```
    commit eb3261c12c910ec562e016f10431cc48747baef8
    Author: Dan Poirier <dpoirier@caktusgroup.com>
    Date:   Wed Aug 21 11:51:20 2013 -0400

            Enhanced sponsor admin page

```

Signed-off-by: Hiroshi Miura <miurahr@linux.com>
This commit is contained in:
Hiroshi Miura 2015-06-21 14:50:26 +09:00
parent 91ae3de6df
commit 3653cf3c69

View file

@ -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('<a href="mailto:%s">%s</a>' % (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('<a href="mailto:%s">%s</a>' % (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