From 88818c94b55776699470a13232c6f54e3d4742e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Tue, 8 Dec 2015 00:52:02 +0200 Subject: [PATCH] Djano admin tweaks --- hc/payments/admin.py | 5 ++++- hc/payments/views.py | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/hc/payments/admin.py b/hc/payments/admin.py index 67599c92..82dfb0a0 100644 --- a/hc/payments/admin.py +++ b/hc/payments/admin.py @@ -5,4 +5,7 @@ from .models import Subscription @admin.register(Subscription) class SubsAdmin(admin.ModelAdmin): - list_display = ("id", "user") + list_display = ("id", "email", "customer_id", "payment_method_token", "subscription_id") + + def email(self, obj): + return obj.user.email if obj.user else None diff --git a/hc/payments/views.py b/hc/payments/views.py index 49b54a19..a510b527 100644 --- a/hc/payments/views.py +++ b/hc/payments/views.py @@ -50,7 +50,9 @@ def create_plan(request): sub = Subscription.objects.get(user=request.user) if not sub.customer_id: - result = braintree.Customer.create({}) + result = braintree.Customer.create({ + "email": request.user.email + }) if not result.is_success: return log_and_bail(request, result)