Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Charge: add pk to __repr__ #526

Merged
merged 1 commit into from
Dec 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion pinax/stripe/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
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 @@ -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)
Expand Down