【问题标题】:Type Error - SeekDeals() unexpected keyword argument 'user_provider'类型错误 - SeekDeals() 意外关键字参数“user_provider”
【发布时间】:2011-07-18 17:33:19
【问题描述】:

我的看法:

def SeekDeals(request , reply_id):
    reply = SeekReply.objects.get(pk = reply_id)
    obj = SeekDeals (user_provider = reply.person)
    obj.user_seeker = request.user
    obj.seek_id = reply.seek_id
    obj.save()
    # Status - 1, is a flag which conveys that the solution has been found
    # The deal has been done and the seek solution should be taken out of the feed
    reply.seek_id.status = 1;
    reply.seek_id.save()
    replies = SeekReply.objects.filter(seek_id = reply.seek_id)
    for x in replies:
        x.status = 1;
        x.save()
    return HttpResponseRedirect('/seek/dealfixed')

SeekDeals 是我数据库中的表,字段为:

  user_seeker
  user_provider
  seek_id

回溯-

        # Apply view middleware
        for middleware_method in self._view_middleware:
            response = middleware_method(request, callback, callback_args, callback_kwargs)
            if response:
                return response
        try:
            response = callback(request, *callback_args, **callback_kwargs) ...
        except Exception, e:
            # If the view raised an exception, run it through exception
            # middleware, and if the exception middleware returns a
            # response, use that. Otherwise, reraise the exception.
            for middleware_method in self._exception_middleware:response = middleware_method(request, e)

【问题讨论】:

    标签: django object typeerror


    【解决方案1】:

    将您的视图称为“SeekDeals”会影响您的模型“SeekDeals”。重命名其中一个。

    【讨论】:

    • 好伙伴!你救了我一辈子 :D.
    猜你喜欢
    • 2013-09-08
    • 2015-12-11
    • 2017-06-30
    • 1970-01-01
    • 1970-01-01
    • 2021-10-23
    • 1970-01-01
    • 2022-11-14
    • 1970-01-01
    相关资源
    最近更新 更多