54fd1a04b2999ab3257d1ecbf5e23c0af4b05bb8
[wolnelektury.git] / src / push / models.py
1 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
3 #
4 from django.db import models
5 from django.utils.translation import gettext_lazy as _
6
7
8 class Notification(models.Model):
9     timestamp = models.DateTimeField(auto_now_add=True)
10     title = models.CharField(max_length=256, verbose_name=_('title'))
11     body = models.CharField(max_length=2048, verbose_name=_('content'))
12     image = models.ImageField(verbose_name=_('image'), blank=True, upload_to='push/img')
13     message_id = models.CharField(max_length=2048)
14
15     class Meta:
16         ordering = ['-timestamp']
17
18     def __str__(self):
19         return '%s: %s' % (self.timestamp, self.title)