Created models

parent 8f13a413
from django.db import models from django.db import models
from django.urls import reverse
# Create your models here. # Create your models here.
class ForumPost(models.Model):
title = models.CharField(max_length=50)
body = models.TextField()
author = models.CharField(max_length=50)
pub_datetime = models.DateTimeField()
def __str__(self):
return '{}'.format(self.title)
class Reply(models.Model):
body = models.TextField()
author = models.CharField(max_length=50)
pub_datetime = models.DateTimeField()
forum_post = models.ForeignKey(
ForumPost,
on_delete=models.CASCADE
)
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment