I'm very new to python and django..When i tried to follow the tutorial on djangoproject.com i am unable to produce my object as a string despite trying different variations of the code including the following. I am using python 3x
Trial 1
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __str__(self):
return self.question_text
Trial 2
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
return str(Question)
Trial 3
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
print(Question)
Typing this
Question.objects.all()
Still shows
<QuerySet [<Question: Question object]>
Instead of
<QuerySet [<Question: What's up?>]>
Please help!!!!!