All commentables are notifying

This commit is contained in:
Ludovic Stephan 2017-07-15 18:37:47 +02:00
parent 80be26c5b3
commit 26c02df53d

View file

@ -2,32 +2,6 @@ from django.db import models
from django.contrib.auth.models import User
class Commentable(models.Model):
pass
class Thread(models.Model):
topic = models.OneToOne(Commentable)
class Comment(models.Model):
thread = models.ForeignKey(Thread)
parent = models.ForeignKey(
'Comment',
related_name="replies",
)
author = models.ForeignKey(
User,
verbose_name=_("auteur"),
editable=False
)
at = models.DateTimeField(
_("date d'écriture"),
auto_now_add=True
)
text = models.TextField(_("corps du message"))
class Notifying(models.Model):
subscribed = models.ManyToManyField(
User,
@ -51,3 +25,29 @@ class Notification(models.Model):
blank=True
)
text = models.TextField(_("corps de la notification"))
class Commentable(Notifying):
pass
class Thread(models.Model):
topic = models.OneToOne(Commentable)
class Comment(models.Model):
thread = models.ForeignKey(Thread)
parent = models.ForeignKey(
'Comment',
related_name="replies",
)
author = models.ForeignKey(
User,
verbose_name=_("auteur"),
editable=False
)
at = models.DateTimeField(
_("date d'écriture"),
auto_now_add=True
)
text = models.TextField(_("corps du message"))