class Post(models.Model):
title = models.CharField(max_length=200)
pdf = models.FileField()
time = models.DateTimeField(auto_now_add = True)
def __unicode__(self):
return self.title
def __str__(self):
return self.title
def get_absolute_url(self):
return reverse("posts:detail", kwargs={"id": self.id})
class Meta:
ordering = ['-time']