feat: add basic subscriptions + emit notification for comment

This commit is contained in:
2024-08-02 20:03:25 +02:00
parent 24b4b1fad0
commit 198fb88bfd
3 changed files with 61 additions and 4 deletions

View File

@@ -185,6 +185,9 @@ class AdoptionNotice(models.Model):
def get_report_url(self):
return reverse('report-adoption-notice', args=[str(self.id)])
def get_subscriptions(self):
return Subscriptions.objects.filter(adoption_notice=self)
def get_photos(self):
"""
First trys to get group photos that are attached to the adoption notice if there is none it trys to fetch
@@ -557,4 +560,4 @@ class CommentNotification(BaseNotification):
class Subscriptions(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE, verbose_name=_('Nutzer*in'))
adoption_notice = models.ForeignKey(AdoptionNotice, on_delete=models.CASCADE, verbose_name=_('AdoptionNotice'))
created_at = models.DateTimeField(auto_now_add=True)
created_at = models.DateTimeField(auto_now_add=True)