Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python ValueError:int()的文字无效错误_Python_Django_Django Models_Django Views - Fatal编程技术网

Python ValueError:int()的文字无效错误

Python ValueError:int()的文字无效错误,python,django,django-models,django-views,Python,Django,Django Models,Django Views,您好,我正在为我的网站使用Django框架。我在project中有一个视图,它将数据保存到数据库(模型)中。但是当我运行我的程序时,我得到一个错误,如下所示 ValueError:以10为基数的int()的文本无效:“2015-08-24 12:27:58” 我的观点 class ProcessCheckBinningView(JSONResponseMixin, View): #model = OrcAwaiverBin def post(self, request, *arg

您好,我正在为我的网站使用Django框架。我在project中有一个视图,它将数据保存到数据库(模型)中。但是当我运行我的程序时,我得到一个错误,如下所示

ValueError:以10为基数的int()的文本无效:“2015-08-24 12:27:58”

我的观点

class ProcessCheckBinningView(JSONResponseMixin, View):
    #model = OrcAwaiverBin
    def post(self, request, *args, **kwargs):

        status = 'error'
        msg = "this is from me"

        post_body = json.loads(self.request.body)
        fab_value = post_body['fab']
        technode_value = post_body['technode']
        layer_value = post_body['layer']

        print fab_value, technode_value, layer_value
        print "submitted from the template f"
        bin_object = OrcAwaiverBin()
        # Record the last accessed date
        bin_object.fab = fab_value
        bin_object.technology = technode_value
        bin_object.layer = layer_value
        print "OKKKKK"
        bin_object.created_by = '2015-08-24 12:27:58'
        bin_object.date_modified = '2015-08-24 12:27:58'
        bin_object.save()
        return self.render_json_response(dict(status=status, msg=msg))

class CheckBinningView(TemplateView):
    template_name = "orc_enable.html"

    def get_context_data(self, *args, **kwargs):
        context = super(CheckBinningView, self).get_context_data(*args, **kwargs)
        fab = GroupProfile.objects.get(id=self.request.session['ACL_gid']).fab
        gp = GroupProfile.objects.get(id=self.request.session['ACL_gid'])
        context['fab'] = gp.fab
        context['ngapp'] = "CMOD"
        return context
我的模型字段:

date_created = models.DateTimeField(auto_now_add=True)
date_modified = models.DateTimeField(blank=True)

有人能告诉我这里有什么问题吗?提前感谢。

根据错误提示,您应该声明
bin\u对象。由
字段或
bin\u对象创建。日期\u将
字段修改为
IntegerField
问题在于,正如Aswin所说,我的模型只接受整数值。我试图插入日期时间值。谢谢大家

将models.py的代码粘贴到使用my model更新的
OrcAwaiverBin
modelfields@gentle请发布完整的堆栈跟踪!此外,当您试图通过
id
获取
GroupProfile
对象时,是否确定
self.request.session['ACL\u gid']
是整数?没有其日期时间字段。还用模型更新了我的问题