18 lines
467 B
Python
18 lines
467 B
Python
from django.db import models
|
|
|
|
|
|
# move to `const.py`
|
|
|
|
STATUS = (
|
|
(0,"Draft"),
|
|
(1,"Publish")
|
|
)
|
|
# Create your models here.
|
|
class Post(models.Model):
|
|
created = models.DateTimeField(auto_now_add=True)
|
|
title = models.CharField(max_length=100, blank=True, default='')
|
|
body = models.TextField(blank=True, default='')
|
|
owner = models.ForeignKey('auth.User', related_name='posts', on_delete=models.CASCADE)
|
|
|
|
class Meta:
|
|
ordering = ['created'] |