23 lines
681 B
Python
23 lines
681 B
Python
from django.db import models
|
|
|
|
from start.models import AbstractSearchable
|
|
|
|
class Category(models.Model):
|
|
"""
|
|
A category of blog posts
|
|
"""
|
|
name = models.CharField(max_length=50)
|
|
slug = models.SlugField()
|
|
|
|
class BlogPost(AbstractSearchable):
|
|
"""
|
|
Should contain a blogpost
|
|
"""
|
|
title = models.CharField(max_length=50)
|
|
subtitle = models.CharField(max_length=50)
|
|
desc = models.CharField(max_length=250, unique=True)
|
|
body = models.TextField()
|
|
date = models.DateField(blank=True)
|
|
category = models.ForeignKey(Category, on_delete=models.SET_NULL, null=True)
|
|
thumbnail = models.ImageField(blank=True)
|
|
slug = models.SlugField()
|