【问题标题】:module 'website.management.commands.updatemodels' has no attribute 'Command'模块“website.management.commands.updatemodels”没有属性“命令”
【发布时间】:2022-01-11 13:17:06
【问题描述】:

我在使用 django 在我的应用程序“网站”上执行此代码时发现问题

https://i.stack.imgur.com/rr15N.jpg

https://i.stack.imgur.com/LWMP6.jpg

【问题讨论】:

    标签: python django database django-models django-templates


    【解决方案1】:

    请不要将代码添加为屏幕截图,因为它不方便访问。

    这是我看到的错误:

    1. 类名需要是类Command(BaseCommand):
    class Command(BaseCommand):
     ....
    
    

    【讨论】:

    • 谢谢先生,我知道我已将查询更改为:对于 Product_Name,Product_Price in zip(df.Product_name,df.Price): models=Product.objects.get( Product_Name=Product_name,Product_Price=Price) models.save()
    • 问题是prntscr.com/26ch1tz,这是我的excel数据库:prntscr.com/26ch20v
    • 它是查询中的错字...应该是 Product_Name=Product_Name
    • 谢谢先生打扰了
    • 请问您能回答我的问题吗? stackoverflow.com/questions/70672500/…
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-06-04
    • 2021-12-24
    • 2015-05-08
    • 2020-10-17
    • 2020-10-03
    • 2018-08-11
    • 2018-10-20
    相关资源
    最近更新 更多