Commit c794d226 authored by Alissandra Gabrielle C. Tanaliga's avatar Alissandra Gabrielle C. Tanaliga

Finishing assignments app

parents 41298b77 16231c67
# Generated by Django 4.0.3 on 2022-05-19 16:08
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='images/'),
preserve_default=False,
),
]
# Generated by Django 4.0.3 on 2022-05-19 16:13
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/images/'),
),
]
...@@ -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/images/")
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 %}
...@@ -21,4 +21,5 @@ ...@@ -21,4 +21,5 @@
{% endfor %} {% endfor %}
</ul> </ul>
</div> </div>
{% endblock %} {% endblock %}
\ No newline at end of file
...@@ -15,6 +15,8 @@ Including another URLconf ...@@ -15,6 +15,8 @@ Including another URLconf
""" """
from django.contrib import admin from django.contrib import admin
from django.urls import include, path from django.urls import include, path
from django.conf import settings
from django.conf.urls.static import static
from django.conf import settings from django.conf import settings
from django.conf.urls.static import static from django.conf.urls.static import static
......
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