未删除的客户

2024-09-28 23:51:05 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个测试网站,将使用条纹和djstripe 0.8.0订阅付款。你知道吗

我设置了测试数据来测试支付系统是否正常工作。你知道吗

然后我删除了条带测试数据。你知道吗

但是,当我打开django管理控制台并导航到django>;客户时,会显示以下记录,但没有附加到这些记录的用户/客户:

enter image description here

相应的数据库表中没有记录。我甚至从stripe和数据库本身中删除了客户。仍然无法摆脱这些记录。你知道吗

如果尝试从管理控制台访问记录或删除记录,则会收到以下错误消息:

AttributeError:'NoneType'对象没有属性'email'

  File "C:\Users\me\desktop\myappname\env3\lib\site-packages\djstripe\settings.py", line 94, in get_subscriber_model_check_subscriber_for_email_address(subscriber_model, "The customer user model must have an email attribute.")
  File "C:\Users\me\desktop\myappname\env3\lib\site-packages\djstripe\settings.py", line 70, in _check_subscriber_for_email_address
    if ("email" not in subscriber_model._meta.get_all_field_names()) and not has attr(subscriber_model, 'email'):
AttributeError: 'Options' object has no attribute 'get_all_field_names'

如何删除这些记录?


Tags: djangoin数据库getmodel客户email记录
2条回答

首先,我建议更新到最新的djstripe版本(我相信现在是1.0.0)

关于删除记录: 调查型号.py从djstripe类Customer,很明显,删除默认源(即Stripe Customer)并不意味着从djstripe表中删除Customer

class Customer(StripeCustomer):
...
default_source = ForeignKey(StripeSource, null=True, related_name="customers", on_delete=SET_NULL)

设置为时,删除=设置为空

我要么联系djstripe(authors)的作者(Daniel Greenfield是个很棒的人),要么在相应的GitHub页面(Github djstripe)上提出一个问题

一般来说,我认为您的软件会启动删除订阅。在Stripe界面中删除它们会使您的代码和djstripe处于冷清状态:)

作为一个硬核修复,我会直接进入相应的数据库并删除这些记录。你知道吗

您必须从auth\u用户模型中删除用户;将auth\u用户模型视为其客户模型。为清楚起见,请阅读文档。 https://dj-stripe.readthedocs.io/en/stable-1.0/reference/settings.html#djstripe-subscriber-model-settings-auth-user-model

相关问题 更多 >