Commit f6370b5b authored by Tanya's avatar Tanya

implemented models of app forum

parent d7c73665
# Generated by Django 4.1.7 on 2023-03-06 03:53
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('dashboard', '0001_initial'),
]
operations = [
migrations.CreateModel(
name='ForumPost',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('title', models.CharField(default='', max_length=255)),
('body', models.TextField(default='')),
('pub_datetime', models.DateTimeField()),
('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dashboard.widgetuser')),
],
),
migrations.CreateModel(
name='Reply',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('body', models.TextField(default='')),
('pub_datetime', models.DateTimeField()),
('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dashboard.widgetuser')),
('forum_post', models.ForeignKey(default='', on_delete=django.db.models.deletion.CASCADE, to='forum.forumpost')),
],
),
]
from django.db import models
from dashboard.models import WidgetUser
# Create your models here.
class ForumPost(models.Model):
title = models.CharField(max_length=255,default="")
body = models.TextField(default="")
author = models.ForeignKey(WidgetUser,on_delete=models.CASCADE)
pub_datetime = models.DateTimeField()
def __str__(self):
return '{}'.format(self.title)
class Reply(models.Model):
body = models.TextField(default="")
author = models.ForeignKey(WidgetUser,on_delete=models.CASCADE)
pub_datetime = models.DateTimeField()
forum_post = models.ForeignKey(ForumPost,on_delete=models.CASCADE,default="")
def __str__(self):
return '{}'.format(self.body)
\ No newline at end of file
......@@ -43,6 +43,7 @@ INSTALLED_APPS = [
'django.contrib.staticfiles',
'announcement_board',
'dashboard',
'forum',
]
MIDDLEWARE = [
......
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