Commit 52f439b3 authored by karin-kurusu's avatar karin-kurusu

Updated models.py to implement get_absolute_url to ForumPost

parent f9466461
from django.db import models from django.db import models
from dashboard.models import WidgetUser from dashboard.models import WidgetUser
from django.urls import reverse
class ForumPost(models.Model): class ForumPost(models.Model):
title = models.CharField(max_length=100) title = models.CharField(max_length=100)
...@@ -10,6 +11,9 @@ class ForumPost(models.Model): ...@@ -10,6 +11,9 @@ class ForumPost(models.Model):
def __str__(self): def __str__(self):
return self.title return self.title
def get_absolute_url(self):
return reverse("forum:forumpost-details", kwargs={"pk": self.pk})
class Reply(models.Model): class Reply(models.Model):
body = models.TextField() body = models.TextField()
author = models.ForeignKey(WidgetUser, on_delete=models.CASCADE) author = models.ForeignKey(WidgetUser, on_delete=models.CASCADE)
......
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