13 lines
No EOL
615 B
Python
13 lines
No EOL
615 B
Python
from django.contrib.contenttypes.fields import GenericForeignKey
|
|
from django.db import models
|
|
from django.contrib.contenttypes.models import ContentType
|
|
|
|
class DiscordNotification(models.Model):
|
|
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
|
|
object_id = models.PositiveIntegerField()
|
|
content_object = GenericForeignKey('content_type', 'object_id')
|
|
is_announced = models.BooleanField(default=False)
|
|
created_at = models.DateTimeField(auto_now_add=True)
|
|
|
|
def __str__(self):
|
|
return f"Annonces pour {self.content_object} ({'✅' if self.is_announced else '⏳'})" |