Website/blog/models.py

15 lines
436 B
Python

from django.contrib.auth.models import User
from django.db import models
from django.utils import timezone
# Create your models here.
class Blog(models.Model):
content = models.TextField()
title = models.CharField(max_length=150)
author = models.TextField() #models.ForeignKey(User, on_delete=models.CASCADE)
date_posted = models.DateTimeField(default=timezone.now)
def get_absolute_url(self):
return '/'