Edited and migrated models

parent 7dbe8ebb
# Generated by Django 3.2 on 2023-05-12 08:38
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('forum', '0002_alter_forumpost_author'),
]
operations = [
migrations.AlterModelOptions(
name='forumpost',
options={'ordering': ['pub_datetime']},
),
]
......@@ -12,8 +12,14 @@ class ForumPost(models.Model):
)
pub_datetime = models.DateTimeField()
class Meta:
ordering = ['pub_datetime']
def __str__(self):
return '{}'.format(self.title)
def get_absolute_url(self):
return reverse("forum:forumpostdetails", kwargs={"pk": self.pk})
class Reply(models.Model):
body = models.TextField()
......@@ -23,4 +29,5 @@ class Reply(models.Model):
ForumPost,
on_delete=models.CASCADE
)
\ No newline at end of file
def get_absolute_url(self):
return reverse("forum:replydetails", kwargs={'pk': self.pk})
\ No newline at end of file
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