審覈後djStripe的我帶着2個解決方案的代碼,你可以看到有:
def user_has_active_subscription(user):
warnings.warn("Deprecated - Use ``subscriber_has_active_subscription`` instead. This method will be removed in dj-stripe 1.0.", DeprecationWarning)
return subscriber_has_active_subscription(user)
然後,你必須使用它代替:
@cached_property
def has_active_subscription(self):
"""Checks if a user has an active subscription."""
return user_has_active_subscription(self)
但仍然沒有爲工作我,當我仍然在閱讀時,我發現這個警告:
幫助函數檢查訂戶是否有活動的訂閱。 如果訂閱者是AUTH_USER_MODEL 和get_user_model()。is_anonymous == True的實例,則引發錯誤配置。
我的問題恰恰是,我在呼喚我的個人資料這個功能,那麼這個解決它:
@cached_property
def has_active_subscription(self):
"""Checks if a user has an active subscription."""
return user_has_active_subscription(self.user)
UPDATE:我的錯誤是我目前的系統出了問題,你可以在這裏閱讀更多:https://github.com/pydanny/dj-stripe/issues/203#issuecomment-110230688