Skip to content

Commit

Permalink
Merge pull request #526 from blueyed/charge-repr-pk-upstream
Browse files Browse the repository at this point in the history
Charge: add pk to __repr__
  • Loading branch information
paltman authored Dec 1, 2017
2 parents 257a9f2 + 79c61fd commit dd87314
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion pinax/stripe/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,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,
Expand Down
4 changes: 2 additions & 2 deletions pinax/stripe/tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,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)
Expand Down

0 comments on commit dd87314

Please sign in to comment.