From 79c61fd8b31d49d58842fe992c8de0ff8171e079 Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Mon, 27 Nov 2017 20:29:44 +0100 Subject: [PATCH] Charge: add pk to __repr__ --- pinax/stripe/models.py | 3 ++- pinax/stripe/tests/test_models.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pinax/stripe/models.py b/pinax/stripe/models.py index 29489307b..bad902e94 100644 --- a/pinax/stripe/models.py +++ b/pinax/stripe/models.py @@ -472,7 +472,8 @@ class Charge(StripeAccountFromCustomerMixin, StripeObject): objects = ChargeManager() def __repr__(self): - return "Charge(customer={!r}, source={!r}, amount={!r}, captured={!r}, paid={!r}, stripe_id={!r})".format( + return "Charge(pk={!r}, customer={!r}, source={!r}, amount={!r}, captured={!r}, paid={!r}, stripe_id={!r})".format( + self.pk, self.customer, self.source, self.amount, diff --git a/pinax/stripe/tests/test_models.py b/pinax/stripe/tests/test_models.py index f515daf6a..6bc85cd25 100644 --- a/pinax/stripe/tests/test_models.py +++ b/pinax/stripe/tests/test_models.py @@ -131,9 +131,9 @@ def test_connected_customer_str_and_repr(self): def test_charge_repr(self): charge = Charge() if PY2: - self.assertEquals(repr(charge), "Charge(customer=None, source=u'', amount=None, captured=None, paid=None, stripe_id=u'')") + self.assertEquals(repr(charge), "Charge(pk=None, customer=None, source=u'', amount=None, captured=None, paid=None, stripe_id=u'')") else: - self.assertEquals(repr(charge), "Charge(customer=None, source='', amount=None, captured=None, paid=None, stripe_id='')") + self.assertEquals(repr(charge), "Charge(pk=None, customer=None, source='', amount=None, captured=None, paid=None, stripe_id='')") def test_plan_display_invoiceitem(self): p = Plan(amount=decimal.Decimal("5"), name="My Plan", interval="monthly", interval_count=1)