2016-07-19 06:07:49 +00:00
|
|
|
from django.contrib import admin
|
2016-07-27 05:08:45 +00:00
|
|
|
from django.utils.html import format_html
|
|
|
|
from django.core.urlresolvers import reverse
|
|
|
|
|
|
|
|
from .models import Donation
|
|
|
|
|
2016-07-19 06:07:49 +00:00
|
|
|
|
|
|
|
# Register your models here.
|
2016-07-27 05:08:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
class DonationAdmin(admin.ModelAdmin):
|
|
|
|
|
|
|
|
list_display = ('id', 'donation', 'donator')
|
|
|
|
search_fields = ['id', 'donator__user__email']
|
|
|
|
|
|
|
|
def user(self, obj):
|
|
|
|
email = obj.customer.user.email
|
|
|
|
user_url = reverse("admin:membership_customuser_change", args=[obj.customer.user.id])
|
|
|
|
return format_html("<a href='{url}'>{email}</a>", url=user_url, email=email)
|
|
|
|
|
|
|
|
|
|
|
|
admin.site.register(Donation, DonationAdmin)
|