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

Upgrade to dj-stripe 1.2.4 #2

Open
wants to merge 74 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
20cb6bb
Scope cancel_subscription() to Subscription admin
jleclanche Jan 16, 2018
c110361
Fix duplicate stripe_id in ChargeAdmin.search_fields
jleclanche Jan 16, 2018
db2eab1
Remove an unnecessary import
jleclanche Mar 18, 2018
4606b69
Revert "Revert "Fix SubscriptionRestView with Django Rest Framework 3…
jleclanche May 23, 2018
f1ae1c7
Change account_balance and delinquent to default on get_or_create()
jleclanche Mar 18, 2018
161781b
Use ugettext_lazy instead of ugettext for enums
jleclanche May 23, 2018
69f4e7b
Set a SECRET_KEY in tests
jleclanche May 24, 2018
292250b
Always pass allowed_hosts=None to is_safe_url()
jleclanche May 24, 2018
fd1dd12
Drop superfluous star-import in stripe_objects.py
jleclanche May 27, 2018
3d9eed1
docs: Drop reference to django-polymorphic
jleclanche May 27, 2018
7796888
docs: Fix compatibility with Django 2.0
jleclanche May 27, 2018
2510bb6
Add a tox -e docs command
jleclanche May 27, 2018
67cfc8c
docs: Drop unnecessary command
jleclanche May 27, 2018
edf83bf
Add support for setting STRIPE_API_HOST
jleclanche Mar 18, 2018
5d3a878
Implement better stringified output for Charge
jleclanche Feb 5, 2018
e8697ae
Implement FileUpload model
jleclanche Jan 15, 2018
e7adcd6
Implement FileUploadAdmin
jleclanche Jan 15, 2018
61388ae
Use models import for admin
jleclanche Jan 16, 2018
58ae6e8
Implement Account fields
jleclanche Jan 17, 2018
950ea92
Update Invoice model with all the new fields (as of 2018-05-21)
jleclanche May 23, 2018
6d54812
Update Plan model with all the new fields (as of 2018-05-21)
jleclanche May 27, 2018
10c7002
Implement Product model
jleclanche May 27, 2018
eb08a07
Upgrade API to 2018-05-21
jleclanche May 27, 2018
d250f1d
Drop unused python-doc-inherit dependency
jleclanche May 27, 2018
8fbc957
Clean up CustomerAdmin fields
jleclanche May 27, 2018
edb4e15
Remove deprecated STATUS_* attributes on Subscription and Transfer
jleclanche May 27, 2018
814192e
Remove Transfer.destination_type choices (field is deprecated)
jleclanche May 27, 2018
8aa62d2
Update Subscription model with all the new fields (as of 2018-05-21)
jleclanche May 27, 2018
0e1f112
Implement Refund model
jleclanche May 28, 2018
1a9faa2
Use models import instead of individual imports
jleclanche May 28, 2018
4a4e002
Fixing tests for users on WSL.
kavdev May 29, 2018
4e360bc
Move event_handlers import to __init__.py
jleclanche May 29, 2018
2a68ba7
Overhauled documentation. Credit for the toctree restructuring goes t…
kavdev May 25, 2018
6a6f048
Implement StripeEnumField, based on StripeCharField
jleclanche May 28, 2018
2e63b42
Switch all enum-type fields to StripeEnumField
jleclanche May 28, 2018
eedee47
Make Coupon.__str__ the human-readable display
jleclanche Jun 2, 2018
703bb8b
Mark deprecated Plan fields as not-required
jleclanche Jun 4, 2018
154fb34
Add a friendlier __str__ to Invoice and InvoiceItem
jleclanche Jun 4, 2018
38e997d
Add hosted_invoice_url and invoice_pdf fields to Invoice
jleclanche Jun 4, 2018
69dc6da
Add changelog for 1.1.0
jleclanche Jun 10, 2018
9383f72
Release 1.1.0
jleclanche Jun 10, 2018
840eafb
Reset migrations
jleclanche Jun 10, 2018
5d079c3
Release 1.2.0
jleclanche Jun 10, 2018
5b7de34
Python 2.7 Fixes
nickdjones Jun 26, 2018
7d032dd
Increase receipt_number max length
jleclanche Jun 21, 2018
8ced34a
Mark Account business_name and business_primary_color as not required
jleclanche Jun 21, 2018
38d6da5
Set Product.deactivate_on and images fields as stripe_required=False
nickdjones Jun 26, 2018
32b75fc
Add product to webhook calls
nickdjones Jun 22, 2018
30657c0
Mark Customer.shipping as not required
jamezpolley Jul 4, 2018
bf82cc9
Import InvalidRequestError from stripe-python directly
jleclanche Jul 13, 2018
9f0e6ef
Catch InvalidRequestError on source sync
jleclanche Jul 13, 2018
446407c
Add cryptography and pyOpenSSL as dependencies in Python 2 tests
jleclanche Jul 18, 2018
a74aa2b
Mark customer coupon, shipping and days_until_due as blank=True
jamezpolley Jul 4, 2018
1e81c54
Fix desynced business_vat_id field migration
jleclanche Jul 18, 2018
31f07a0
Release 1.2.1
jleclanche Jul 18, 2018
2a37cf0
Fix flake8 issue
jleclanche Jul 18, 2018
e34211c
Fall back to ROOT_URLCONF in SubscriptionPaymentMiddleware
jleclanche Jul 24, 2018
bc8ff59
Always save CharFields and TextFields as empty strings instead of nulls
jleclanche Jul 28, 2018
ad8c032
Take DJSTRIPE_SUBSCRIBER_MODEL_MIGRATION_DEPENDENCY into account
hgezim Aug 7, 2018
7446311
Fix reactivate() with Stripe API 2018-02-28 and above
jleclanche Aug 11, 2018
0e9d41f
Release 1.2.2
jleclanche Aug 11, 2018
f64af57
Update Subscription.cancel for compatibility with 2018-08-23
imacek Sep 2, 2018
776738c
Release 1.2.3
jleclanche Oct 13, 2018
edfbbf6
Add trial_from_plan, trial_period_days args to Customer.subscribe()
martinhill Jul 17, 2018
7afa58a
Fix product webhook for type="good"
therefromhere Nov 1, 2018
080153d
Implement Invoice._manipulate_stripe_object_hook for compatability wi…
therefromhere Nov 17, 2018
46c6c37
Update Cancel subscription view tests to match backport in f64af57
therefromhere Dec 4, 2018
03a39db
Fixup plan amount null with tier plans resolves #781
Feb 1, 2019
c778473
Allow billing_cycle_anchor argument when creating a subscription
PabloCastellano Feb 4, 2019
fd0fa51
Release 1.2.4
therefromhere Feb 27, 2019
baa7d03
Fix Python 2 unicode issues with Coupon.__str__()
michi88 Jul 13, 2018
410d75a
Wrap webhook processing in atomic transaction to fix save issue
lskillen Mar 25, 2018
52bdc05
Update to dj-stripe 1.1.1
AndrewSpeed Nov 23, 2020
1bb8a1a
Update to dj-stripe 1.2.4
AndrewSpeed Nov 24, 2020
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
Prev Previous commit
Next Next commit
Clean up CustomerAdmin fields
CLoses dj-stripe#534
Supercedes dj-stripe#594
  • Loading branch information
jleclanche committed May 27, 2018

Verified

This commit was signed with the committer’s verified signature.
commit 8fbc957c910b4f55bfb2a6b13691f709bf073658
21 changes: 5 additions & 16 deletions djstripe/admin.py
Original file line number Diff line number Diff line change
@@ -154,21 +154,6 @@ class SubscriptionInline(admin.StackedInline):
show_change_link = True


def subscription_status(customer):
"""
Return a string representation of the customer's subscription status.

If the customer does not have a subscription, an empty string is returned.
"""
if customer.subscription:
return customer.subscription.status
else:
return ""


subscription_status.short_description = "Subscription Status"


class InvoiceItemInline(admin.StackedInline):
"""A TabularInline for use InvoiceItem."""

@@ -232,8 +217,12 @@ class CouponAdmin(StripeObjectAdmin):
@admin.register(models.Customer)
class CustomerAdmin(StripeObjectAdmin):
raw_id_fields = ("subscriber", "default_source", "coupon")
list_display = ("subscriber", subscription_status)
list_display = (
"subscriber", "email", "currency", "default_source", "coupon",
"account_balance", "business_vat_id",
)
list_filter = (CustomerHasSourceListFilter, CustomerSubscriptionStatusListFilter)
search_fields = ("email", "description")
inlines = (SubscriptionInline, )


22 changes: 0 additions & 22 deletions tests/test_admin.py
Original file line number Diff line number Diff line change
@@ -8,21 +8,12 @@
"""
from __future__ import absolute_import, division, print_function, unicode_literals

from copy import deepcopy

from django.contrib import admin
from django.contrib.auth import get_user_model
from django.test import TestCase
from mock import patch

from djstripe.admin import subscription_status
from djstripe.models import Subscription

from . import FAKE_CUSTOMER, FAKE_PLAN, FAKE_SUBSCRIPTION


class TestAdminSite(TestCase):

def setUp(self):
self.user = get_user_model().objects.create_user(username="pydanny", email="[email protected]")

@@ -39,16 +30,3 @@ def test_search_fields(self):
table_name=model_name.lower())),
'Bad search field <{search_field}> for {model_name} model.'.format(
search_field=search_field, model_name=model_name))

@patch("stripe.Plan.retrieve", return_value=deepcopy(FAKE_PLAN))
@patch("stripe.Customer.retrieve", return_value=deepcopy(FAKE_CUSTOMER))
def test_subscription_status(self, customer_mock, plan_mock):
customer = FAKE_CUSTOMER.create_for_user(self.user)
subscription_fake = deepcopy(FAKE_SUBSCRIPTION)
subscription = Subscription.sync_from_stripe_data(subscription_fake)

self.assertEqual(subscription.status, subscription_status(customer))

def test_subscription_status_no_sub(self):
customer = FAKE_CUSTOMER.create_for_user(self.user)
self.assertEqual("", subscription_status(customer))