Commit 61400199 authored by karin-kurusu's avatar karin-kurusu

Created models ForumPost and Reply and performed migrations

parent 403ae6f1
# Generated by Django 4.1.7 on 2023-03-05 19:50
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('announcements', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='reaction',
name='name',
field=models.CharField(choices=[('Like', 'Like'), ('Love', 'Love'), ('Angry', 'Angry')], max_length=5),
),
]
# Generated by Django 4.1.7 on 2023-03-05 19:50
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(max_length=100)),
('body', models.TextField()),
('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()),
('pub_datetime', models.DateTimeField()),
('author', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dashboard.widgetuser')),
('forumpost', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='forum.forumpost')),
],
),
]
from django.db import models from django.db import models
from dashboard.models import WidgetUser
class ForumPost(models.Model):
title = models.CharField(max_length=100)
body = models.TextField()
author = models.ForeignKey(WidgetUser, on_delete=models.CASCADE)
pub_datetime = models.DateTimeField()
def __str__(self):
return self.title
class Reply(models.Model):
body = models.TextField()
author = models.ForeignKey(WidgetUser, on_delete=models.CASCADE)
pub_datetime = models.DateTimeField()
forumpost = models.ForeignKey(ForumPost, on_delete=models.CASCADE)
def __str__(self):
return self.body
# Create your models here. # Create your models here.
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