Add dummy data

This commit is contained in:
Andros Fenollosa
2021-03-09 22:03:17 +01:00
parent e3e1a0144c
commit 8ea8476cc8
11 changed files with 6206 additions and 32 deletions

View File

@@ -1,3 +1,32 @@
from django.db import models
# Create your models here.
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)
class Meta:
ordering = ['-created_on']
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)
class Meta:
ordering = ['-created_on']
def __str__(self):
return self.name