我不知道该怎么做。这个网页框架的新手请帮帮我 我收到这个错误:
unbound method save() must be called with DinkProfile instance as first argument (got nothing instead)
我的观点是:
dinkprofile = DinkProfile
dinkprofile.title = 'owner'
dinkprofile.user = request.user.id
dinkprofile.save()
型号名称:
class DinkProfile(models.Model):
user = models.OneToOneField(auth.models.User)
title = models.CharField(max_length=75)
答案 0 :(得分:15)
您在这里缺少括号:
dinkprofile = DinkProfile
应该是:
dinkprofile = DinkProfile()