This is my model:
class Position(models.Model): map = models.ForeignKey(Map,primary_key=True) #members=models.CharField(max_length=200) LatLng = models.CharField(max_length=40000) infowindow = models.CharField(max_length=40000)
But it can't run. What is the max size of the max_length
parameter?
Django tip: Use models. TextField for storing long texts inside your models instead of models. CharField since CharField has a max length of 255 characters while TextField can hold more than 255 characters.
TextField can contain more than 255 characters, but CharField is used to store shorter length of strings. When you want to store long text, use TextField, or when you want shorter strings then CharField is useful.
That depends on the database backend. The Django DB Docs will tell you, that max_length=255
is guaranteed to work always.
If you need something of the amount you've specified in your question, I'd suggest to use a TextField.
Use TextField
instead
infowindow = models.TextField()
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With