Skip to content

Commit

Permalink
indexing deleted and unread fields to increase performance
Browse files Browse the repository at this point in the history
  • Loading branch information
harrypotterismyname committed Oct 3, 2016
1 parent 0e658dc commit 38a2ee6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions notifications/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,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')
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')
actor_object_id = models.CharField(max_length=255)
Expand All @@ -172,7 +172,7 @@ class Notification(models.Model):
timestamp = models.DateTimeField(default=timezone.now)

public = models.BooleanField(default=True)
deleted = models.BooleanField(default=False)
deleted = models.BooleanField(default=False, db_index = True)
emailed = models.BooleanField(default=False)

data = JSONField(blank=True, null=True)
Expand Down

0 comments on commit 38a2ee6

Please sign in to comment.