Use:
import datetime
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField(auto_now=True)
class Meta:
ordering = ['-pub_date']
def __str__(self):
return self.question_text
delete all objects of your pas
Hi,
I'm am trying to follow along with the tutorial, but keep getting this
error when I migrate the models. Here is my models.py file for the polls
app:
from django.db import models
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTim
2 matches
Mail list logo