Skip to content

Commit

Permalink
Merge pull request pinax#300 from jambonsw/card-in-admin
Browse files Browse the repository at this point in the history
Added some missing admin registrations.
  • Loading branch information
paltman authored Dec 13, 2016
2 parents aaa4516 + 8aa80ac commit 8333755
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 4 deletions.
41 changes: 38 additions & 3 deletions pinax/stripe/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,16 @@
from .models import ( # @@@ make all these read-only
Charge,
Subscription,
Card,
BitcoinReceiver,
Customer,
Event,
EventProcessingException,
Invoice,
InvoiceItem,
Plan,
Transfer
Transfer,
TransferChargeFee
)


Expand Down Expand Up @@ -175,6 +178,20 @@ def queryset(self, request, queryset):

class SubscriptionInline(admin.TabularInline):
model = Subscription
extra = 0
max_num = 0


class CardInline(admin.TabularInline):
model = Card
extra = 0
max_num = 0


class BitcoinReceiverInline(admin.TabularInline):
model = BitcoinReceiver
extra = 0
max_num = 0


def subscription_status(obj):
Expand Down Expand Up @@ -203,12 +220,18 @@ def subscription_status(obj):
search_fields=[
"stripe_id",
] + user_search_fields(),
inlines=[SubscriptionInline]
inlines=[
SubscriptionInline,
CardInline,
BitcoinReceiverInline
]
)


class InvoiceItemInline(admin.TabularInline):
model = InvoiceItem
extra = 0
max_num = 0


def customer_has_card(obj):
Expand Down Expand Up @@ -256,7 +279,9 @@ def customer_user(obj):
"period_end",
"total"
],
inlines=[InvoiceItemInline]
inlines=[
InvoiceItemInline
]
)

admin.site.register(
Expand Down Expand Up @@ -290,6 +315,13 @@ def customer_user(obj):
],
)


class TransferChargeFeeInline(admin.TabularInline):
model = TransferChargeFee
extra = 0
max_num = 0


admin.site.register(
Transfer,
raw_id_fields=["event"],
Expand All @@ -303,5 +335,8 @@ def customer_user(obj):
search_fields=[
"stripe_id",
"event__stripe_id"
],
inlines=[
TransferChargeFeeInline
]
)
2 changes: 1 addition & 1 deletion pinax/stripe/tests/test_email.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class EmailReceiptTest(TestCase):

def setUp(self):
User = get_user_model()
self.user = User.objects.create_user(username="patrick")
self.user = User.objects.create_user(username="patrick", email='[email protected]')
self.customer = Customer.objects.create(
user=self.user,
stripe_id="cus_xxxxxxxxxxxxxxx"
Expand Down

0 comments on commit 8333755

Please sign in to comment.