from django.db import models
class Topic(models.Model):
text = models.CharField(max_length=200)
date_added = models.DateTimeField(auto_now_add=True)
def _str_(self):
return self.text
class Entry(models.Model):
topic = models.ForeignKey(Topic)
text = models.TextField
date_added = models.DateTimeField(auto_now_add=True)
class Meta:
verbose_name_plural= 'entries'
def _str_(self):
return self.text[:50]+"..."
This is my code,When i run:
python3 manage.py makemigrations learning_logs
The answer is :
TypeError: __init__() missing 1 required positional argument: 'on_delete'
why this warning ? I read the documentation too, but no help.