from django.db import models
from django.utils import timezone
from django.contrib.auth.models import User
# Create your models here.

# on delete is what we do when we delete the user itself
# in this case we would delete the users post as well
# Cascade deletes the posts.


class Post(models.Model):
    title = models.CharField(max_length=100)
    content = models.TextField()
    date_posted = models.DateTimeField(default=timezone.now)
    author = models.ForeignKey(User, on_delete=models.CASCADE)

    def __str__(self):
        return self.title