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

Once on a time-table query using orm be linked, there Python int too large to convert to C long the problem:

After analyzing the error, the error in the final surface prompt are:

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

In my view model.py file when my model is defined as:

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 ()
     # author and author information in one 
    AuthorDetail = models.OneToOneField (to = " AuthorDetail " , on_delete = models.CASCADE) 


class AuthorDetail (models.Model): 
    NID = models.AutoField (primary_key = True)
    # Birthday = models.DateField () # especially after watching this line of conduct, not You will then be prompted Python int too large to convert to C long the 
    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()

Guess you like

Origin www.cnblogs.com/one-tom/p/12051545.html