Answer the question
In order to leave comments, you need to log in
Django, want to add 2000 columns to database?
I want to add 2000 columns with different dates to the database, there are no errors, just the dates are not filled in when makemigratons and migrate
class parts_direct_stpc(models.Model):
title = models.CharField('Название', max_length=50)
now = datetime.now().date()
data = []
for i in range(2000):
data.append(None)
for i in range(2000):
data[i] = models.CharField(str(now + timedelta(i)), max_length=20)
def __str__(self):
return self.title
Answer the question
In order to leave comments, you need to log in
It's too early for you to take on Django, you obviously don't know Python.
On the face of a design error or misunderstanding of relationships, you do not need 2000 columns.
for i in range(2000):
data.append(None)
ಠ_ಠ want to add nothing 2000 times?
Correct data.append(i)
for i in range(2000):
data[i] = models.CharField...
ಠ_ಠ
Check
https://www.codewars.com/ here for your knowledge
var nodesArr = [].slice.call(document.querySelectorAll('div[class*="innerItem"]'));
nodesArr.map(function(item) {
console.log(item)
//....
})
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question