Plankton_Detector/PlanktonDetector/Community/models.py
2023-12-13 02:11:29 +01:00

18 lines
533 B
Python

from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Post(models.Model):
title = models.CharField(max_length=500)
content = models.TextField()
author = models.ForeignKey(User, on_delete=models.CASCADE, null=False)
date_pub = models.DateField(auto_now_add=True)
class Comment(models.Model):
author = models.ForeignKey(User, on_delete=models.CASCADE, null=False)
content = models.TextField()
post = models.ForeignKey(Post, on_delete=models.CASCADE)