mirror of
https://github.com/Hopiu/django-notifications.git
synced 2026-05-02 10:44:42 +00:00
Added indexes (closes #153)
This commit is contained in:
parent
1379d3b52b
commit
abc4c27f2a
2 changed files with 37 additions and 4 deletions
33
notifications/migrations/0006_indexes.py
Normal file
33
notifications/migrations/0006_indexes.py
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
# Generated by Django 2.0.2 on 2018-02-19 14:21
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('notifications', '0005_auto_20160504_1520'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='notification',
|
||||
name='deleted',
|
||||
field=models.BooleanField(db_index=True, default=False),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='notification',
|
||||
name='emailed',
|
||||
field=models.BooleanField(db_index=True, default=False),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='notification',
|
||||
name='public',
|
||||
field=models.BooleanField(db_index=True, default=True),
|
||||
),
|
||||
migrations.AlterField(
|
||||
model_name='notification',
|
||||
name='unread',
|
||||
field=models.BooleanField(db_index=True, default=True),
|
||||
),
|
||||
]
|
||||
|
|
@ -170,7 +170,7 @@ class Notification(models.Model):
|
|||
level = models.CharField(choices=LEVELS, default=LEVELS.info, max_length=20)
|
||||
|
||||
recipient = models.ForeignKey(settings.AUTH_USER_MODEL, blank=False, related_name='notifications', on_delete=models.CASCADE)
|
||||
unread = models.BooleanField(default=True, blank=False)
|
||||
unread = models.BooleanField(default=True, blank=False, db_index=True)
|
||||
|
||||
actor_content_type = models.ForeignKey(ContentType, related_name='notify_actor', on_delete=models.CASCADE)
|
||||
actor_object_id = models.CharField(max_length=255)
|
||||
|
|
@ -190,9 +190,9 @@ class Notification(models.Model):
|
|||
|
||||
timestamp = models.DateTimeField(default=timezone.now)
|
||||
|
||||
public = models.BooleanField(default=True)
|
||||
deleted = models.BooleanField(default=False)
|
||||
emailed = models.BooleanField(default=False)
|
||||
public = models.BooleanField(default=True, db_index=True)
|
||||
deleted = models.BooleanField(default=False, db_index=True)
|
||||
emailed = models.BooleanField(default=False, db_index=True)
|
||||
|
||||
data = JSONField(blank=True, null=True)
|
||||
objects = NotificationQuerySet.as_manager()
|
||||
|
|
|
|||
Loading…
Reference in a new issue