This repository has been archived by the owner on Jun 29, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d3c5820
commit 3776168
Showing
4 changed files
with
65 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# coding=utf-8 | ||
""" | ||
""" | ||
__author__ = 'Alisue <lambdalisue@hashnote.net>' | ||
from django.contrib.contenttypes.models import ContentType | ||
from kawaz.core.personas.models import Persona | ||
from kawaz.apps.activities.models import Activity | ||
from kawaz.apps.activities.mediator import ActivityMediator | ||
|
||
|
||
class HatenablogEntryActivityMediator(ActivityMediator): | ||
|
||
def alter(self, instance, activity, **kwargs): | ||
if activity and activity.status == 'updated': | ||
# 通知が必要な状態の変更を詳細に記録する | ||
if activity.previous is not None: | ||
previous = activity.previous.snapshot | ||
if previous.md5 == instance.md5: | ||
# Nothing have changed | ||
return | ||
return activity |
30 changes: 30 additions & 0 deletions
30
src/kawaz/apps/activities/contrib/hatenablog/migrations/0002_auto_20141014_2146.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import unicode_literals | ||
|
||
from django.db import models, migrations | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('hatenablog', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.AddField( | ||
model_name='hatenablogentry', | ||
name='md5', | ||
field=models.CharField(default='', max_length=32), | ||
preserve_default=False, | ||
), | ||
migrations.AlterField( | ||
model_name='hatenablogentry', | ||
name='created_at', | ||
field=models.DateTimeField(verbose_name='Created at'), | ||
), | ||
migrations.AlterField( | ||
model_name='hatenablogentry', | ||
name='title', | ||
field=models.CharField(verbose_name='Title', max_length=128), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters