Once, when using ORM to perform a join table query, there was a problem with Python int too large to convert to C long
After analyzing the error, the last prompt of the error is as follows:
File "F:\python\python3.6\lib\sqlite3\dbapi2.py", line 64, in convert_date
return datetime.date(*map(int, val.split(b"-")))
When viewing my model.py file, my model definition is as follows:
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() # In particular, this line is commented out so that it no longer prompts 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()
Similar Posts:
- How to Solve Django Error: No such column: xxx
- [Solved] django DRF This field may not be null, This field cannot be blank
- Python TypeError: __init__() missing 1 required positional argument: ‘on_delete’
- [Solved] Pycharm Error: TypeError: init() missing 1 required positional argument: ‘on_delete’
- Django: How to Convert Models object to JSON
- Python AttributeError: ‘unicode’ object has no attribute ‘tzinfo’
- Django auth.User.groups: (fields.E304) Reverse accessor for User.groups clashes with reverse
- One of the ways to display no author, no date in SVN log
- Solve the problem of “typeerror: ‘bool’ object is not callable” in flash and Django
- Get the time value from the database and report an error: Java sql. Timestamp cannot be cast to java. lang.Long