Commit 3c5f9018 authored by Eugene Ezekiel P. Tan's avatar Eugene Ezekiel P. Tan

reply and post rel. model added, image model added

parent 5a962a96
# Generated by Django 4.0.3 on 2022-05-13 03:31
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('Forum', '0002_post_post_author_reply'),
]
operations = [
migrations.AddField(
model_name='post',
name='post_imageUrl',
field=models.CharField(default=1, max_length=999),
),
]
# Generated by Django 4.0.3 on 2022-05-13 03:42
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('Forum', '0003_post_post_imageurl'),
]
operations = [
migrations.AddField(
model_name='reply',
name='reply_post',
field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='Forum.post'),
),
]
......@@ -7,11 +7,18 @@ class Post(models.Model):
post_body = models.CharField(max_length=500)
pub_date = models.DateTimeField("date published")
post_author = models.ForeignKey(WidgetUser, on_delete=models.CASCADE, default=1)
post_imageUrl = models.CharField(max_length=999, default = 1)
def __str__(self):
return self.post_title
class Reply(models.Model):
reply_body = models.CharField(max_length=50)
pub_date = models.DateTimeField("date published")
reply_author = models.ForeignKey(WidgetUser, on_delete=models.CASCADE, default=1)
reply_post = models.ForeignKey(Post, on_delete=models.CASCADE, default=1)
def __str__(self):
thing = self.reply_body + " by " + self.reply_author.last_name + " @ " + self.reply_post.post_title
return thing
......@@ -19,3 +19,7 @@ ul {
border: 5px solid black;
background-color: aliceblue;
}
img {
max-width: 500px;
}
\ No newline at end of file
......@@ -6,13 +6,18 @@
<h4>{{post.post_author.first_name}} {{post.post_author.last_name}}, {{post.pub_date.day}}/{{post.pub_date.month}}/{{post.pub_date.year}}</h4>
<h3>{{post.post_body}}</h3>
<img src= >
<img src= {{post.post_imageUrl}}>
<ul>
{% for reply in reply_list %}
{% if reply.reply_post.post_title == post.post_title %}
<li><u>Reply by {{reply.reply_author.first_name}} {{reply.reply_author.last_name}} dated {{reply.pub_date.day}}/{{reply.pub_date.month}}/{{reply.pub_date.year}}:</u> <br>
{{reply.reply_body}}</li>
</br>
{% endif %}
{% endfor %}
</ul>
......
# Generated by Django 4.0.3 on 2022-05-13 03:31
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('assignments', '0003_course_assignment_passing_score_assignment_course'),
]
operations = [
migrations.AlterField(
model_name='assignment',
name='course',
field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.CASCADE, to='assignments.course'),
),
]
No preview for this file type
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