Commit aaf5eadd authored by Bianca Aguilar's avatar Bianca Aguilar

Fixing up forum app

parent be8e1bca
No preview for this file type
# Generated by Django 4.0.3 on 2022-05-19 16:53
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('forum', '0011_alter_post_pub_date_alter_reply_pub_date'),
]
operations = [
migrations.AddField(
model_name='post',
name='image',
field=models.ImageField(default=1, upload_to='forum/images/'),
preserve_default=False,
),
]
# Generated by Django 4.0.3 on 2022-05-19 16:58
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('forum', '0012_post_image'),
]
operations = [
migrations.AlterField(
model_name='post',
name='image',
field=models.ImageField(upload_to='forum/'),
),
]
...@@ -10,6 +10,7 @@ class Post(models.Model): ...@@ -10,6 +10,7 @@ class Post(models.Model):
'homepage.WidgetUser', 'homepage.WidgetUser',
on_delete=models.CASCADE on_delete=models.CASCADE
) )
image = models.ImageField(upload_to='forum/')
def __str__(self): def __str__(self):
return '{}'.format(self.post_title) return '{}'.format(self.post_title)
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<h1>{{ object.post_title }}</h1> <h1>{{ object.post_title }}</h1>
<h2>by {{ object.author.first_name }} {{ object.author.last_name }}, {{ object.pub_date|date:"d/m/Y" }}</h2> <h2>by {{ object.author.first_name }} {{ object.author.last_name }}, {{ object.pub_date|date:"d/m/Y" }}</h2>
<p>{{ object.post_body }}</p> <p>{{ object.post_body }}</p>
<img src="{% static 'images/forum.jpg' %}"> <img src="{{ object.image.url }}">
</div> </div>
<ul class="replies"> <ul class="replies">
{% for r in object.comments.all %} {% for r in object.comments.all %}
......
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