Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index les relations generiques des modeles des notifs. #3594

Merged
merged 2 commits into from
May 9, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions update.md
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,8 @@ Notifications
1. Lors de l'application des migrations `python manage.py migrate`, Django va vous demander s'il doit supprimer la table topicfollowed. Renseignez oui.
2. Exécuter la commande `python manage.py migrate_subscriptions` pour migrer les anciennes notifications vers les nouvelles.

Si vous constatez des problèmes de performance, lancez la commande suivante : `mysqloptimize -uroot -p zdsdb`

Liste des tags exclus
---------------------

Expand Down
24 changes: 24 additions & 0 deletions zds/notification/migrations/0008_auto_20160507_1504.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('notification', '0007_auto_20160121_2343'),
]

operations = [
migrations.AlterField(
model_name='notification',
name='object_id',
field=models.PositiveIntegerField(db_index=True),
),
migrations.AlterField(
model_name='subscription',
name='object_id',
field=models.PositiveIntegerField(db_index=True),
),
]
4 changes: 2 additions & 2 deletions zds/notification/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class Meta:
is_active = models.BooleanField(_(u'Actif'), default=True, db_index=True)
by_email = models.BooleanField(_(u'Recevoir un email'), default=False)
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
object_id = models.PositiveIntegerField(db_index=True)
content_object = GenericForeignKey('content_type', 'object_id')
last_notification = models.ForeignKey(u'Notification', related_name="last_notification", null=True, default=None)

Expand Down Expand Up @@ -267,7 +267,7 @@ class Meta:
subscription = models.ForeignKey(Subscription, related_name='subscription', db_index=True)
pubdate = models.DateTimeField(_(u'Date de création'), auto_now_add=True, db_index=True)
content_type = models.ForeignKey(ContentType)
object_id = models.PositiveIntegerField()
object_id = models.PositiveIntegerField(db_index=True)
content_object = GenericForeignKey('content_type', 'object_id')
is_read = models.BooleanField(_(u'Lue'), default=False, db_index=True)
url = models.CharField('URL', max_length=255)
Expand Down