Guest User

Untitled

a guest
Apr 24th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. class Entry(models.Model):
  2. STATUS_CHOICES = (
  3. (1, 'Draft'),
  4. (2, 'Public'),
  5. (3, 'Private'))
  6.  
  7. author = models.ForeignKey(User)
  8. comments_enabled = models.BooleanField(default=True)
  9. slug = models.SlugField(prepopulate_from=('title',),
  10. unique_for_date='pub_date')
  11.  
  12. title = models.CharField(max_length=250)
  13. body = models.TextField()
  14. excerpt = models.TextField()
  15. status = models.IntegerField(choices=STATUS_CHOICES, default=2)
  16. categories = models.ManyToManyField(Category)
  17. pub_date = models.DateTimeField('Date posted', default=datetime.datetime.today)
  18. update_date = models.DateTimeField()
  19.  
  20. #tags
  21.  
  22. class Meta:
  23. get_latest_by = 'pub_date'
  24. ordering = ['-pub_date']
  25.  
  26. class Admin:
  27. pass
  28.  
  29. def unicode(self):
  30. return self.title
Add Comment
Please, Sign In to add comment