22 lines
502 B
Python
22 lines
502 B
Python
from django.db import models
|
|
import markdown
|
|
|
|
|
|
class Citation(models.Model):
|
|
"""
|
|
Représente les citations.
|
|
"""
|
|
|
|
quote = models.TextField(
|
|
help_text="Only MarkDown is authorized",
|
|
)
|
|
author = models.CharField(max_length=50, null=True, blank=True)
|
|
|
|
def __str__(self):
|
|
return f"{self.quote} - {self.author}"
|
|
|
|
def to_markdown(self):
|
|
"""Convertit le champ `informations` en (Github-flavored) Markdown."""
|
|
|
|
return markdown.markdown(self.quote)
|