djangoldp-notification/djangoldp_notifications/models.py
Matthieu Fesselier d24b176039 First commit
2019-01-09 16:27:54 +07:00

23 lines
762 B
Python

from django.db import models
from django.conf import settings
from django.contrib.auth.models import User
class Notification(models.Model):
user = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='user')
author_user = models.ForeignKey(settings.AUTH_USER_MODEL, related_name='author')
object = models.URLField()
type = models.CharField(max_length=255)
summary = models.TextField()
date = models.DateTimeField(auto_now_add=True)
read = models.BooleanField()
class Meta:
permissions = (
('view_notification', 'Read'),
('control_notification', 'Control'),
)
auto_author = 'author_user'
ordering = ['date']
def __str__(self):
return '{}'.format(self.type)