So I'm working on the model.py in Django and i'm getting 2 pylint errors. I don't understand why? is this an issue with pylint or something i'm doing wrong in my code.
E1120:No value for argument 'on_delete' in constructor call
E1136:Value 'self.text' is unsubscriptable
The first is on line 19, in Entry topic = models.ForeignKey(Topic)
The second is on line 24 self.text[:50]
If I remove the entry class the code works
from django.db import models
# Create your models here.
class Topic(models.Model):
"""A topic the user is learning about"""
text = models.CharField(max_length=200)
date_added = models.DateTimeField(auto_now_add=True)
def __str__(self):
"""Return a string representation of the model."""
return self.text
class Entry(models.Model):
"""Something specific learned about a topic"""
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 a string representation of the model."""
return self.text[:50] + "..."