13 lines
517 B
Python
13 lines
517 B
Python
from django.contrib.auth.models import User
|
|
from django.db import models
|
|
|
|
class Post(models.Model):
|
|
author = models.ForeignKey(User, on_delete=models.CASCADE)
|
|
title = models.CharField(max_length=200)
|
|
slug = models.SlugField(unique=True)
|
|
content = models.TextField()
|
|
created_at = models.DateTimeField(auto_now_add=True)
|
|
intent = models.CharField(max_length=50, default='Neutral')
|
|
|
|
def __str__(self):
|
|
return f'Post by {self.author.username} on {self.created_at.strftime("%Y-%m-%d")}' |