码迷,mamicode.com
首页 > 编程语言 > 详细

python 提示 :OverflowError: Python int too large to convert to C long

时间:2019-12-20 15:11:25      阅读:509      评论:0      收藏:0      [点我收藏+]

标签:hda   inf   api   datetime   分析   alt   sqlite   信息   prim   

一次在使用orm进行联表查询的时候,出现   Python int too large to convert to C long 的问题:

在分析错误之后,在错误最后面提示中有:

  File "F:\python\python3.6\lib\sqlite3\dbapi2.py", line 64, in convert_date
    return datetime.date(*map(int, val.split(b"-")))

技术图片

在查看我的model.py文件的时候我的模型定义是:

from django.db import models


# Create your models here.

class Book(models.Model):
    nid = models.AutoField(primary_key=True)
    title = models.CharField(max_length=64)
    publishDate = models.DateField()
    price = models.DecimalField(max_digits=5, decimal_places=2)

    publish = models.ForeignKey(to="Publish", to_field="nid", on_delete=models.CASCADE)

    authors = models.ManyToManyField(to="Author")


class Author(models.Model):
    nid = models.AutoField(primary_key=True)
    name = models.CharField(max_length=32)
    age = models.IntegerField()
    # 作者和作者信息一对一
    AuthorDetail=models.OneToOneField(to="AuthorDetail",on_delete=models.CASCADE)


class AuthorDetail(models.Model):
    nid = models.AutoField(primary_key=True)
    # birthday = models.DateField()  # 特别是这一行进行注视后,就不会再提示 Python int too large to convert to C long  了
    tetephone = models.BigIntegerField()
    addr = models.CharField(max_length=64)


class Publish(models.Model):
    nid = models.AutoField(primary_key=True)
    name = models.CharField(max_length=32)
    city = models.CharField(max_length=32)
    email = models.EmailField()

python 提示 :OverflowError: Python int too large to convert to C long

标签:hda   inf   api   datetime   分析   alt   sqlite   信息   prim   

原文地址:https://www.cnblogs.com/one-tom/p/12051545.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!