Я получаю сообщение об ошибке Внешний ключ не определен
task_name=ForeignKey(Task_List, on_delete=models.SET_NULL, null=True)
NameError: имя 'ForeignKey' не определено
models.py:
class Task_List(models.Model):
task_name=models.CharField(max_length=100, default="NOT SPECIFIED")
c1=models.CharField(max_length=30, default="OTHER")
c2=models.CharField(max_length=30, default="OTHER")
c3=models.CharField(max_length=30, default="OTHER")
time_esc=models.IntegerField(default=1)
def __str__(self):
return self.title
class Task_manager(models.Manager):
def create_Task(self, title):
Task1 = self.create(title=title)
# do something with the book
return Task1
class Task(models.Model):
task_name=ForeignKey(Task_List, on_delete=models.SET_NULL, null=True)
title=models.CharField(max_length=30,default="Other", blank=Ture)
created=models.DateTimeField(auto_now_add=True)
objects=Task_manager()
class Meta:
ordering = [ '-created']
def __str__(self):
return self.title