mirror of
https://github.com/Hopiu/django-notifications.git
synced 2026-04-01 04:30:24 +00:00
40 lines
2 KiB
Python
40 lines
2 KiB
Python
# -*- coding: utf-8 -*-
|
|
from __future__ import unicode_literals
|
|
|
|
from django.db import models, migrations
|
|
import django.utils.timezone
|
|
from django.conf import settings
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
('contenttypes', '0001_initial'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.CreateModel(
|
|
name='Notification',
|
|
fields=[
|
|
('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)),
|
|
('level', models.CharField(default=b'info', max_length=20, choices=[(b'success', b'success'), (b'info', b'info'), (b'warning', b'warning'), (b'error', b'error')])),
|
|
('unread', models.BooleanField(default=True)),
|
|
('actor_object_id', models.CharField(max_length=255)),
|
|
('verb', models.CharField(max_length=255)),
|
|
('description', models.TextField(null=True, blank=True)),
|
|
('target_object_id', models.CharField(max_length=255, null=True, blank=True)),
|
|
('action_object_object_id', models.CharField(max_length=255, null=True, blank=True)),
|
|
('timestamp', models.DateTimeField(default=django.utils.timezone.now)),
|
|
('public', models.BooleanField(default=True)),
|
|
('action_object_content_type', models.ForeignKey(related_name=b'notify_action_object', blank=True, to='contenttypes.ContentType', null=True)),
|
|
('actor_content_type', models.ForeignKey(related_name=b'notify_actor', to='contenttypes.ContentType')),
|
|
('recipient', models.ForeignKey(related_name=b'notifications', to=settings.AUTH_USER_MODEL)),
|
|
('target_content_type', models.ForeignKey(related_name=b'notify_target', blank=True, to='contenttypes.ContentType', null=True)),
|
|
],
|
|
options={
|
|
'ordering': ('-timestamp',),
|
|
},
|
|
bases=(models.Model,),
|
|
),
|
|
]
|