models: Create database indexes on auxiliary Message fields.

I suspect we'll want these for narrowing code at some point.

(imported from commit d2077aa4d7a6967bb4cb7d9404a4db4fcf824343)
This commit is contained in:
Tim Abbott 2012-12-07 17:21:26 -05:00
parent 02d65664b4
commit c21535d420
1 changed files with 2 additions and 2 deletions

View File

@ -405,9 +405,9 @@ def linebreak(string):
class Message(models.Model): class Message(models.Model):
sender = models.ForeignKey(UserProfile) sender = models.ForeignKey(UserProfile)
recipient = models.ForeignKey(Recipient) recipient = models.ForeignKey(Recipient)
subject = models.CharField(max_length=MAX_SUBJECT_LENGTH) subject = models.CharField(max_length=MAX_SUBJECT_LENGTH, db_index=True)
content = models.TextField() content = models.TextField()
pub_date = models.DateTimeField('date published') pub_date = models.DateTimeField('date published', db_index=True)
sending_client = models.ForeignKey(Client) sending_client = models.ForeignKey(Client)
def __repr__(self): def __repr__(self):