Commit 276424fd authored by Norberto Tadeo's avatar Norberto Tadeo 😔

added reply model, added author relationship to reply and post, changed views.py to display data

parent 525e556e
......@@ -2,7 +2,6 @@ from django.db import models
from homepage.models import WidgetUser
class Post(models.Model):
#Author = WidgetUser.objects.all()
post_title = models.CharField(max_length=50)
post_body = models.CharField(max_length=100000)
pub_date = models.DateField(auto_now_add=True)
......@@ -17,10 +16,7 @@ class Reply(models.Model):
pub_date = models.DateField(auto_now_add=True)
author = models.ForeignKey(WidgetUser, null = True, on_delete=models.CASCADE, default ='Anonymous')
active = models.BooleanField(default=True)
#parent = models.ForeignKey('self', null=True,blank=True,related_name='replies')
#class Meta:
#ordering = ('pub_date')
def __str__(self):
if len(self.reply_body) >= 50:
return 'Reply to ({} | {}) by {} - {}... | {}'.format(self.post.post_title,self.post.pub_date, self.author, self.reply_body[0:50],self.pub_date)
......
from django.shortcuts import render
from . import models
from asyncio.windows_events import NULL
# Create your views here.
from django.http import HttpResponse
def displayForumPosts(request):
......
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