您好我正在爲我的網站使用Django框架。我有一個項目中的查看,將數據保存到數據庫(模型)。ValueError:無效文字爲int()錯誤
date_created = models.DateTimeField(auto_now_add=True)
date_modified = models.DateTimeField(blank=True)
有人能告訴我什麼問題:但是當我運行我的程序如下
ValueError: invalid literal for int() with base 10: '2015-08-24 12:27:58'
我views.py
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
我的模型領域正在一個錯誤這裏?提前致謝。
粘貼'OrcAwaiverBin'模型的models.py代碼 –
更新了我的模型字段 – gentle
@gentle請發佈完整的堆棧跟蹤!另外,你確定'self.request.session ['ACL_gid']'是整數,因爲你試圖通過'id'獲得'GroupProfile'對象嗎? – ozgur