from django.db import models STATUS = ( (0,"Draft"), (1,"Publish") ) class Post(models.Model): title = models.CharField(max_length=200, unique=True) author = models.CharField(max_length=20) content = models.TextField() status = models.IntegerField(choices=STATUS, default=0) created_on = models.DateTimeField(auto_now_add=True) def __str__(self): return self.title class Comment(models.Model): name = models.CharField(max_length=20) body = models.CharField(max_length=128) post = models.ForeignKey(Post, on_delete= models.CASCADE) created_on = models.DateTimeField(auto_now_add=True) def __str__(self): return self.name