Skip to content

Commit

Permalink
Add db index
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorfs committed Jul 15, 2016
1 parent eebb4c5 commit 621f6ec
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
19 changes: 19 additions & 0 deletions woid/apps/services/migrations/0014_auto_20160715_1202.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import models, migrations


class Migration(migrations.Migration):

dependencies = [
('services', '0013_auto_20151117_1205'),
]

operations = [
migrations.AlterField(
model_name='story',
name='date',
field=models.DateField(auto_now_add=True, db_index=True),
),
]
16 changes: 8 additions & 8 deletions woid/apps/services/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __unicode__(self):
return self.name

def to_dict(self):
return {
return {
'name': self.name,
'slug': self.slug,
'url': self.url
Expand Down Expand Up @@ -69,7 +69,7 @@ class Story(models.Model):
comments = models.IntegerField(default=0)
start_score = models.IntegerField(default=0)
score = models.IntegerField(default=0)
date = models.DateField(auto_now_add=True)
date = models.DateField(auto_now_add=True, db_index=True)
status = models.CharField(max_length=1, default=NEW, choices=STATUS)
top_ten = models.BooleanField(default=False)
nsfw = models.BooleanField(default=False)
Expand All @@ -96,12 +96,12 @@ def get_template(self):

def to_dict(self):
return {
'code': self.code,
'title': self.title,
'url': self.url,
'comments': self.comments,
'score': self.score,
'description': self.description
'code': self.code,
'title': self.title,
'url': self.url,
'comments': self.comments,
'score': self.score,
'description': self.description
}


Expand Down

0 comments on commit 621f6ec

Please sign in to comment.