Jarvis/jarvis/core/models.py

94 lines
4.6 KiB
Python
Raw Normal View History

2023-04-25 17:06:14 +02:00
from django.db import models
import markdown
2024-02-03 17:20:42 +01:00
from jarvis.people.models import Gymnast
MAIL_HEADER = """
<html><head><style id="canary-invert">html {
filter: invert(100%) hue-rotate(180deg) !important;
}
img,
video,
:not(object):not(body)>embed,
object,
svg image,
[style*="background:url"],
[style*="background-image:url"],
[style*="background: url"],
[style*="background-image: url"],
[background],
twitterwidget,
.canary-emoji {
filter: invert(100%) hue-rotate(180deg) !important;
}
[style*="background:url"] *,
[style*="background-image:url"] *,
[style*="background: url"] *,
[style*="background-image: url"] *,
input,
[background] *,
img[src^="https://s0.wp.com/latex.php"],
twitterwidget .NaturalImage-image {
filter: none !important;
}
</style></head><body contenteditable="true" style="font-family:Helvetica;font-size:13px;">Gregory Trullemans<br>
</body></html>"""
MAIL_FOOTER = """<br />
<p>Excellente journée</p>
<p>Jarvis</p>
<p><b>Trampoline Trainer Help</b></p>
<table border="0">
<tbody>
<tr>
<td>
<img id="CB70323B-AC4A-4992-9DD8-3F25DC32658C" height="80px" src="https://www.flyingacrobaticstrampoline.be/img/logo_120px.png" style="max-width: 100vw;">
</td>
<td>
<b><span class="" style="color: rgb(253, 221, 12);">F</span><span class="" style="color: rgb(251, 214, 13);">l</span><span class="" style="color: rgb(249, 207, 14);">y</span><span class="" style="color: rgb(247, 200, 15);">i</span><span class="" style="color: rgb(245, 194, 16);">n</span><span class="" style="color: rgb(243, 187, 17);">g</span>&nbsp;<span class="" style="color: rgb(241, 180, 18);"></span><span class="" style="color: rgb(239, 173, 19);">A</span><span class="" style="color: rgb(237, 166, 20);">c</span><span class="" style="color: rgb(234, 159, 21);">r</span><span class="" style="color: rgb(232, 153, 22);">o</span><span class="" style="color: rgb(230, 146, 23);">b</span><span class="" style="color: rgb(228, 139, 24);">a</span><span class="" style="color: rgb(226, 132, 25);">t</span><span class="" style="color: rgb(224, 125, 26);">i</span><span class="" style="color: rgb(222, 118, 27);">c</span><span class="" style="color: rgb(220, 112, 28);">s</span>&nbsp;<span class="" style="color: rgb(218, 105, 29);"></span><span class="" style="color: rgb(216, 98, 30);">T</span><span class="" style="color: rgb(214, 91, 31);">r</span><span class="" style="color: rgb(212, 84, 32);">a</span><span class="" style="color: rgb(210, 77, 33);">m</span><span class="" style="color: rgb(208, 70, 34);">p</span><span class="" style="color: rgb(206, 64, 35);">o</span><span class="" style="color: rgb(204, 57, 36);">l</span><span class="" style="color: rgb(201, 50, 37);">i</span><span class="" style="color: rgb(199, 43, 38);">n</span><span class="" style="color: rgb(197, 36, 39);">e</span>&nbsp;<span class="" style="color: rgb(195, 29, 40);"></span><span class="" style="color: rgb(193, 23, 41);">C</span><span class="" style="color: rgb(191, 16, 42);">l</span><span class="" style="color: rgb(189, 9, 43);">u</span><span class="" style="color: rgb(187, 2, 44);">b</span></b><br>
<span style="font-size: 13px; letter-spacing: 0.01em; line-height: 1.2;">Rue René Francq, 7</span><br>
<span style="font-size: 13px; letter-spacing: 0.01em; line-height: 1.2;">1428 Lillois-Witterzée</span>
</td>
</tr>
</tbody>
</table>"""
2023-04-25 17:06:14 +02:00
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)
2024-02-03 17:20:42 +01:00
class Email(models.Model):
"""
Stocke les emails à envoyer/envoyés.
"""
title = models.CharField(max_length=255)
receivers = models.CharField(max_length=255)
body = models.TextField()
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
sent_at = models.DateTimeField(default=None, null=True)
last_tried_at = models.DateTimeField(default=None, null=True)
def __str__(self):
return f"`{self.title}` sent to {self.receivers}"