Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
content_type_id and object_id fields indexed
  • Loading branch information
guglielmo committed Apr 6, 2018
1 parent 7083848 commit 28aa852
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 2 deletions.
4 changes: 2 additions & 2 deletions popolo/behaviors/models.py
Expand Up @@ -25,8 +25,8 @@ class GenericRelatable(models.Model):
"""
An abstract class that provides the possibility of generic relations
"""
content_type = models.ForeignKey(ContentType, blank=True, null=True)
object_id = models.PositiveIntegerField(null=True)
content_type = models.ForeignKey(ContentType, blank=True, null=True, db_index=True)
object_id = models.PositiveIntegerField(null=True, db_index=True)
content_object = GenericForeignKey('content_type', 'object_id')

class Meta:
Expand Down
45 changes: 45 additions & 0 deletions popolo/migrations/0004_auto_20180406_1942.py
@@ -0,0 +1,45 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-04-06 17:42
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('popolo', '0003_auto_20171228_1336'),
]

operations = [
migrations.AlterField(
model_name='classificationrel',
name='object_id',
field=models.PositiveIntegerField(db_index=True, null=True),
),
migrations.AlterField(
model_name='contactdetail',
name='object_id',
field=models.PositiveIntegerField(db_index=True, null=True),
),
migrations.AlterField(
model_name='identifier',
name='object_id',
field=models.PositiveIntegerField(db_index=True, null=True),
),
migrations.AlterField(
model_name='linkrel',
name='object_id',
field=models.PositiveIntegerField(db_index=True, null=True),
),
migrations.AlterField(
model_name='othername',
name='object_id',
field=models.PositiveIntegerField(db_index=True, null=True),
),
migrations.AlterField(
model_name='sourcerel',
name='object_id',
field=models.PositiveIntegerField(db_index=True, null=True),
),
]

0 comments on commit 28aa852

Please sign in to comment.