Add str to comment

This commit is contained in:
Gabriel Augendre 2020-08-20 10:22:18 +02:00
parent c997c6b9aa
commit fbfceecc93

View file

@ -134,5 +134,8 @@ class Comment(AdminUrlMixin, models.Model):
class Meta: class Meta:
ordering = ["created_at"] ordering = ["created_at"]
def __str__(self):
return f"{self.username} - {self.content[:50]}"
def get_absolute_url(self): def get_absolute_url(self):
return self.article.get_absolute_url() + "#" + str(self.id) return self.article.get_absolute_url() + "#" + str(self.id)