我已经创建了一个数字产品的eCommerce应用程序,其中我已经在我的产品模型的配置文件模型中创建了一个ManyToMany关系。在我添加了多对多字段后,在我的配置文件模型中,它阻碍了我创建新的配置文件,并给出了以下错误消息:- ValueError: needs to have a value for field "id</e
:%s' % newthing1.id)# create an instance of Thing2 and save the thing2 recordtry: newthing2.target_id = target_id #newthing2.thing1raise clientnamedb_log
我已经创建了一个扩展的用户模型,我使用在我的注册页面。这两个定制的模型是"Cristin“和一个名为"Rolle”的多到多的领域(个人在组织中的角色)。在我添加了多到多字段之后,我得到了以下错误消息:ValueError at /accounts/signup/ -“UserExtended:需要有一个</
当我试图在许多关系中添加许多内容时,我得到了下面的错误。只有当我试图将多个字段添加到多个字段时,才会发生错误。相同的模型,没有数据,对许多许多字段负载很好。needs to have a value for field "manual_reference" before this many-to-many relationship can be used
每当创建新的model2时,我都会尝试创建一个新的model1,并将这两个模型连接起来。Model2与model1有很多关系class model1Admin(admin.ModelAdmin):
if not obj.id:
obj.payments.add(model2.objects.create())