What is the max size of 'max_length' in Django?

前端 未结 4 1771
名媛妹妹
名媛妹妹 2021-02-01 00:31

This is my model:

class Position(models.Model):
    map = models.ForeignKey(Map,primary_key=True)
    #members=models.CharField(max_length=200)
    LatLng = mode         


        
4条回答
  •  旧巷少年郎
    2021-02-01 00:44

    It depends on the backend database. If you use MySQL 5.6 then there is a limit of 65,535. If you are using above that then it will allow for 1024 also but not beyond that.

    class Demo(models.Model):
        max_test = models.CharField(max_length=1024)
    

    I ran above on MySQL 5.7

提交回复
热议问题