From d297017eb13e0ed57c04305a5db031626c9611f3 Mon Sep 17 00:00:00 2001 From: Zhongyuan Date: Mon, 7 Dec 2015 11:17:37 +0800 Subject: [PATCH 01/29] Drop support for Django 1.6 and below --- .gitignore | 1 + README.rst | 27 ++---- notifications/models.py | 4 +- .../south_migrations/0001_initial.py | 96 ------------------- .../0002_auto__add_field_notification_data.py | 78 --------------- ...003_auto__add_field_notification_unread.py | 79 --------------- .../0004_convert_readed_to_unread.py | 77 --------------- ...005_auto__del_field_notification_readed.py | 78 --------------- ...0006_auto__add_field_notification_level.py | 79 --------------- ...ta__add_field_notification_deleted__add.py | 96 ------------------- .../0008_auto__add_field_notification_data.py | 81 ---------------- notifications/south_migrations/__init__.py | 0 notifications/tests/settings.py | 1 - setup.py | 10 +- 14 files changed, 14 insertions(+), 693 deletions(-) delete mode 100644 notifications/south_migrations/0001_initial.py delete mode 100644 notifications/south_migrations/0002_auto__add_field_notification_data.py delete mode 100644 notifications/south_migrations/0003_auto__add_field_notification_unread.py delete mode 100644 notifications/south_migrations/0004_convert_readed_to_unread.py delete mode 100644 notifications/south_migrations/0005_auto__del_field_notification_readed.py delete mode 100644 notifications/south_migrations/0006_auto__add_field_notification_level.py delete mode 100644 notifications/south_migrations/0007_auto__del_field_notification_data__add_field_notification_deleted__add.py delete mode 100644 notifications/south_migrations/0008_auto__add_field_notification_data.py delete mode 100644 notifications/south_migrations/__init__.py diff --git a/.gitignore b/.gitignore index 21e9974..90b342c 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ MANIFEST .coverage htmlcov /.idea/ +*.egg-info diff --git a/README.rst b/README.rst index 756b67e..4613869 100644 --- a/README.rst +++ b/README.rst @@ -24,6 +24,12 @@ For example: `justquick `_ ``(actor)`` *closed* ` Nomenclature of this specification is based on the Activity Streams Spec: ``_ +Requirements +============ + +- Python 2.7, 3.2, 3.3, 3.4, 3.5 +- Django 1.7, 1.8, 1.9 + Installation ============ @@ -66,26 +72,7 @@ Add the notifications urls to your urlconf:: The method of installing these urls, importing rather than using ``'notifications.urls'``, is required to ensure that the urls are installed in the ``notifications`` namespace. - -How to migrate schema -========================================= - -For Django 1.4~1.6 ------------------- - -`django-south` support is shipped with `django-notifications`. - -#. Install latest version (>=1.0) `django-south `_ -#. Execute ``manage.py migrate notifications`` to migrate `django-notifications` schema - -Note: If you use a `custom user model `_ in your application, you may want to check `reverse dependencies `_ of South to run your migrations in the correct order. - -For Django 1.7 --------------- - -Django 1.7 has built-in support for migrations. No need to install `django-south`. - -#. Execute ``manage.py migrate notifications`` +To run schema migration, execute ``python manage.py migrate notifications``. Generating Notifications ========================= diff --git a/notifications/models.py b/notifications/models.py index 181d750..5b60ec1 100644 --- a/notifications/models.py +++ b/notifications/models.py @@ -17,7 +17,7 @@ from .utils import id2slug from .signals import notify -from model_utils import managers, Choices +from model_utils import Choices from jsonfield.fields import JSONField @@ -190,7 +190,7 @@ class Notification(models.Model): emailed = models.BooleanField(default=False) data = JSONField(blank=True, null=True) - objects = managers.PassThroughManager.for_queryset_class(NotificationQuerySet)() + objects = NotificationQuerySet.as_manager() class Meta: ordering = ('-timestamp', ) diff --git a/notifications/south_migrations/0001_initial.py b/notifications/south_migrations/0001_initial.py deleted file mode 100644 index b7ede3d..0000000 --- a/notifications/south_migrations/0001_initial.py +++ /dev/null @@ -1,96 +0,0 @@ -# -*- coding: utf-8 -*- -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - -try: - from django.contrib.auth import get_user_model -except ImportError: # django < 1.5 - from django.contrib.auth.models import User -else: - User = get_user_model() - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding model 'Notification' - db.create_table('notifications_notification', ( - ('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), - ('recipient', self.gf('django.db.models.fields.related.ForeignKey')(related_name='notifications', to=User)), - ('readed', self.gf('django.db.models.fields.BooleanField')(default=False)), - ('actor_content_type', self.gf('django.db.models.fields.related.ForeignKey')(related_name='notify_actor', to=orm['contenttypes.ContentType'])), - ('actor_object_id', self.gf('django.db.models.fields.CharField')(max_length=255)), - ('verb', self.gf('django.db.models.fields.CharField')(max_length=255)), - ('description', self.gf('django.db.models.fields.TextField')(null=True, blank=True)), - ('target_content_type', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='notify_target', null=True, to=orm['contenttypes.ContentType'])), - ('target_object_id', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank=True)), - ('action_object_content_type', self.gf('django.db.models.fields.related.ForeignKey')(blank=True, related_name='notify_action_object', null=True, to=orm['contenttypes.ContentType'])), - ('action_object_object_id', self.gf('django.db.models.fields.CharField')(max_length=255, null=True, blank=True)), - ('timestamp', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime.now)), - ('public', self.gf('django.db.models.fields.BooleanField')(default=True)), - )) - db.send_create_signal('notifications', ['Notification']) - - - def backwards(self, orm): - # Deleting model 'Notification' - db.delete_table('notifications_notification') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'notifications.notification': { - 'Meta': {'ordering': "('-timestamp',)", 'object_name': 'Notification'}, - 'action_object_content_type': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'notify_action_object'", 'null': 'True', 'to': "orm['contenttypes.ContentType']"}), - 'action_object_object_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), - 'actor_content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'notify_actor'", 'to': "orm['contenttypes.ContentType']"}), - 'actor_object_id': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'public': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'readed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'recipient': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'notifications'", 'to': "orm['auth.User']"}), - 'target_content_type': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'notify_target'", 'null': 'True', 'to': "orm['contenttypes.ContentType']"}), - 'target_object_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), - 'timestamp': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'verb': ('django.db.models.fields.CharField', [], {'max_length': '255'}) - } - } - - complete_apps = ['notifications'] diff --git a/notifications/south_migrations/0002_auto__add_field_notification_data.py b/notifications/south_migrations/0002_auto__add_field_notification_data.py deleted file mode 100644 index c8925d3..0000000 --- a/notifications/south_migrations/0002_auto__add_field_notification_data.py +++ /dev/null @@ -1,78 +0,0 @@ -# -*- coding: utf-8 -*- -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding field 'Notification.data' - db.add_column('notifications_notification', 'data', - self.gf('django.db.models.fields.TextField')(null=True, blank=True), - keep_default=False) - - - def backwards(self, orm): - # Deleting field 'Notification.data' - db.delete_column('notifications_notification', 'data') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'notifications.notification': { - 'Meta': {'ordering': "('-timestamp',)", 'object_name': 'Notification'}, - 'action_object_content_type': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'notify_action_object'", 'null': 'True', 'to': "orm['contenttypes.ContentType']"}), - 'action_object_object_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), - 'actor_content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'notify_actor'", 'to': "orm['contenttypes.ContentType']"}), - 'actor_object_id': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'data': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'public': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'readed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'recipient': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'notifications'", 'to': "orm['auth.User']"}), - 'target_content_type': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'notify_target'", 'null': 'True', 'to': "orm['contenttypes.ContentType']"}), - 'target_object_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), - 'timestamp': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'verb': ('django.db.models.fields.CharField', [], {'max_length': '255'}) - } - } - - complete_apps = ['notifications'] \ No newline at end of file diff --git a/notifications/south_migrations/0003_auto__add_field_notification_unread.py b/notifications/south_migrations/0003_auto__add_field_notification_unread.py deleted file mode 100644 index 6063a6a..0000000 --- a/notifications/south_migrations/0003_auto__add_field_notification_unread.py +++ /dev/null @@ -1,79 +0,0 @@ -# -*- coding: utf-8 -*- -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding field 'Notification.unread' - db.add_column('notifications_notification', 'unread', - self.gf('django.db.models.fields.BooleanField')(default=True), - keep_default=True) - - - def backwards(self, orm): - # Deleting field 'Notification.unread' - db.delete_column('notifications_notification', 'unread') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'notifications.notification': { - 'Meta': {'ordering': "('-timestamp',)", 'object_name': 'Notification'}, - 'action_object_content_type': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'notify_action_object'", 'null': 'True', 'to': "orm['contenttypes.ContentType']"}), - 'action_object_object_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), - 'actor_content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'notify_actor'", 'to': "orm['contenttypes.ContentType']"}), - 'actor_object_id': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'data': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'public': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'readed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'recipient': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'notifications'", 'to': "orm['auth.User']"}), - 'target_content_type': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'notify_target'", 'null': 'True', 'to': "orm['contenttypes.ContentType']"}), - 'target_object_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), - 'timestamp': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'unread': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'verb': ('django.db.models.fields.CharField', [], {'max_length': '255'}) - } - } - - complete_apps = ['notifications'] \ No newline at end of file diff --git a/notifications/south_migrations/0004_convert_readed_to_unread.py b/notifications/south_migrations/0004_convert_readed_to_unread.py deleted file mode 100644 index 90194b4..0000000 --- a/notifications/south_migrations/0004_convert_readed_to_unread.py +++ /dev/null @@ -1,77 +0,0 @@ -# -*- coding: utf-8 -*- -import datetime -from south.db import db -from south.v2 import DataMigration -from django.db import models - -class Migration(DataMigration): - - def forwards(self, orm): - "" - orm['notifications.Notification'].objects.filter(readed=True).update(unread=False) - orm['notifications.Notification'].objects.filter(readed=False).update(unread=True) - - def backwards(self, orm): - "Write your backwards methods here." - orm['notifications.Notification'].objects.filter(unread=True).update(readed=False) - orm['notifications.Notification'].objects.filter(unread=False).update(readed=True) - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'notifications.notification': { - 'Meta': {'ordering': "('-timestamp',)", 'object_name': 'Notification'}, - 'action_object_content_type': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'notify_action_object'", 'null': 'True', 'to': "orm['contenttypes.ContentType']"}), - 'action_object_object_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), - 'actor_content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'notify_actor'", 'to': "orm['contenttypes.ContentType']"}), - 'actor_object_id': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'data': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'public': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'readed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'recipient': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'notifications'", 'to': "orm['auth.User']"}), - 'target_content_type': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'notify_target'", 'null': 'True', 'to': "orm['contenttypes.ContentType']"}), - 'target_object_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), - 'timestamp': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'unread': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'verb': ('django.db.models.fields.CharField', [], {'max_length': '255'}) - } - } - - complete_apps = ['notifications'] - symmetrical = True diff --git a/notifications/south_migrations/0005_auto__del_field_notification_readed.py b/notifications/south_migrations/0005_auto__del_field_notification_readed.py deleted file mode 100644 index 5b9f3bc..0000000 --- a/notifications/south_migrations/0005_auto__del_field_notification_readed.py +++ /dev/null @@ -1,78 +0,0 @@ -# -*- coding: utf-8 -*- -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Deleting field 'Notification.readed' - db.delete_column('notifications_notification', 'readed') - - - def backwards(self, orm): - # Adding field 'Notification.readed' - db.add_column('notifications_notification', 'readed', - self.gf('django.db.models.fields.BooleanField')(default=False), - keep_default=True) - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'notifications.notification': { - 'Meta': {'ordering': "('-timestamp',)", 'object_name': 'Notification'}, - 'action_object_content_type': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'notify_action_object'", 'null': 'True', 'to': "orm['contenttypes.ContentType']"}), - 'action_object_object_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), - 'actor_content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'notify_actor'", 'to': "orm['contenttypes.ContentType']"}), - 'actor_object_id': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'data': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'public': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'recipient': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'notifications'", 'to': "orm['auth.User']"}), - 'target_content_type': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'notify_target'", 'null': 'True', 'to': "orm['contenttypes.ContentType']"}), - 'target_object_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), - 'timestamp': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'unread': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'verb': ('django.db.models.fields.CharField', [], {'max_length': '255'}) - } - } - - complete_apps = ['notifications'] \ No newline at end of file diff --git a/notifications/south_migrations/0006_auto__add_field_notification_level.py b/notifications/south_migrations/0006_auto__add_field_notification_level.py deleted file mode 100644 index 596a5c2..0000000 --- a/notifications/south_migrations/0006_auto__add_field_notification_level.py +++ /dev/null @@ -1,79 +0,0 @@ -# -*- coding: utf-8 -*- -import datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding field 'Notification.level' - db.add_column('notifications_notification', 'level', - self.gf('django.db.models.fields.CharField')(default='info', max_length=20), - keep_default=False) - - - def backwards(self, orm): - # Deleting field 'Notification.level' - db.delete_column('notifications_notification', 'level') - - - models = { - 'auth.group': { - 'Meta': {'object_name': 'Group'}, - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - 'auth.permission': { - 'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - 'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - 'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - 'notifications.notification': { - 'Meta': {'ordering': "('-timestamp',)", 'object_name': 'Notification'}, - 'action_object_content_type': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'notify_action_object'", 'null': 'True', 'to': "orm['contenttypes.ContentType']"}), - 'action_object_object_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), - 'actor_content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'notify_actor'", 'to': "orm['contenttypes.ContentType']"}), - 'actor_object_id': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'data': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - 'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'level': ('django.db.models.fields.CharField', [], {'default': "'info'", 'max_length': '20'}), - 'public': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'recipient': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'notifications'", 'to': "orm['auth.User']"}), - 'target_content_type': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'notify_target'", 'null': 'True', 'to': "orm['contenttypes.ContentType']"}), - 'target_object_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), - 'timestamp': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'unread': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'verb': ('django.db.models.fields.CharField', [], {'max_length': '255'}) - } - } - - complete_apps = ['notifications'] \ No newline at end of file diff --git a/notifications/south_migrations/0007_auto__del_field_notification_data__add_field_notification_deleted__add.py b/notifications/south_migrations/0007_auto__del_field_notification_data__add_field_notification_deleted__add.py deleted file mode 100644 index 072407e..0000000 --- a/notifications/south_migrations/0007_auto__del_field_notification_data__add_field_notification_deleted__add.py +++ /dev/null @@ -1,96 +0,0 @@ -# -*- coding: utf-8 -*- -from south.utils import datetime_utils as datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Deleting field 'Notification.data' - db.delete_column(u'notifications_notification', 'data') - - # Adding field 'Notification.deleted' - db.add_column(u'notifications_notification', 'deleted', - self.gf('django.db.models.fields.BooleanField')(default=False), - keep_default=False) - - # Adding field 'Notification.emailed' - db.add_column(u'notifications_notification', 'emailed', - self.gf('django.db.models.fields.BooleanField')(default=False), - keep_default=False) - - - def backwards(self, orm): - # Adding field 'Notification.data' - db.add_column(u'notifications_notification', 'data', - self.gf('django.db.models.fields.TextField')(null=True, blank=True), - keep_default=False) - - # Deleting field 'Notification.deleted' - db.delete_column(u'notifications_notification', 'deleted') - - # Deleting field 'Notification.emailed' - db.delete_column(u'notifications_notification', 'emailed') - - - models = { - u'auth.group': { - 'Meta': {'object_name': 'Group'}, - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - u'auth.permission': { - 'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - u'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Group']"}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Permission']"}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - u'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - u'notifications.notification': { - 'Meta': {'ordering': "('-timestamp',)", 'object_name': 'Notification'}, - 'action_object_content_type': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'notify_action_object'", 'null': 'True', 'to': u"orm['contenttypes.ContentType']"}), - 'action_object_object_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), - 'actor_content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'notify_actor'", 'to': u"orm['contenttypes.ContentType']"}), - 'actor_object_id': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - 'emailed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'level': ('django.db.models.fields.CharField', [], {'default': "'info'", 'max_length': '20'}), - 'public': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'recipient': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'notifications'", 'to': u"orm['auth.User']"}), - 'target_content_type': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'notify_target'", 'null': 'True', 'to': u"orm['contenttypes.ContentType']"}), - 'target_object_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), - 'timestamp': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'unread': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'verb': ('django.db.models.fields.CharField', [], {'max_length': '255'}) - } - } - - complete_apps = ['notifications'] \ No newline at end of file diff --git a/notifications/south_migrations/0008_auto__add_field_notification_data.py b/notifications/south_migrations/0008_auto__add_field_notification_data.py deleted file mode 100644 index e8496d5..0000000 --- a/notifications/south_migrations/0008_auto__add_field_notification_data.py +++ /dev/null @@ -1,81 +0,0 @@ -# -*- coding: utf-8 -*- -from south.utils import datetime_utils as datetime -from south.db import db -from south.v2 import SchemaMigration -from django.db import models - - -class Migration(SchemaMigration): - - def forwards(self, orm): - # Adding field 'Notification.data' - db.add_column(u'notifications_notification', 'data', - self.gf('jsonfield.fields.JSONField')(null=True, blank=True), - keep_default=False) - - - def backwards(self, orm): - # Deleting field 'Notification.data' - db.delete_column(u'notifications_notification', 'data') - - - models = { - u'auth.group': { - 'Meta': {'object_name': 'Group'}, - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}), - 'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': u"orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}) - }, - u'auth.permission': { - 'Meta': {'ordering': "(u'content_type__app_label', u'content_type__model', u'codename')", 'unique_together': "((u'content_type', u'codename'),)", 'object_name': 'Permission'}, - 'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['contenttypes.ContentType']"}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '50'}) - }, - u'auth.user': { - 'Meta': {'object_name': 'User'}, - 'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}), - 'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'groups': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Group']"}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}), - 'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}), - 'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "u'user_set'", 'blank': 'True', 'to': u"orm['auth.Permission']"}), - 'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}) - }, - u'contenttypes.contenttype': { - 'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"}, - 'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}), - 'name': ('django.db.models.fields.CharField', [], {'max_length': '100'}) - }, - u'notifications.notification': { - 'Meta': {'ordering': "('-timestamp',)", 'object_name': 'Notification'}, - 'action_object_content_type': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'notify_action_object'", 'null': 'True', 'to': u"orm['contenttypes.ContentType']"}), - 'action_object_object_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), - 'actor_content_type': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'notify_actor'", 'to': u"orm['contenttypes.ContentType']"}), - 'actor_object_id': ('django.db.models.fields.CharField', [], {'max_length': '255'}), - 'data': ('jsonfield.fields.JSONField', [], {'null': 'True', 'blank': 'True'}), - 'deleted': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - 'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}), - 'emailed': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), - u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), - 'level': ('django.db.models.fields.CharField', [], {'default': "'info'", 'max_length': '20'}), - 'public': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'recipient': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'notifications'", 'to': u"orm['auth.User']"}), - 'target_content_type': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'notify_target'", 'null': 'True', 'to': u"orm['contenttypes.ContentType']"}), - 'target_object_id': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}), - 'timestamp': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}), - 'unread': ('django.db.models.fields.BooleanField', [], {'default': 'True'}), - 'verb': ('django.db.models.fields.CharField', [], {'max_length': '255'}) - } - } - - complete_apps = ['notifications'] \ No newline at end of file diff --git a/notifications/south_migrations/__init__.py b/notifications/south_migrations/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/notifications/tests/settings.py b/notifications/tests/settings.py index c1609b9..d882618 100644 --- a/notifications/tests/settings.py +++ b/notifications/tests/settings.py @@ -1,5 +1,4 @@ SECRET_KEY = 'secret_key' -SOUTH_TESTS_MIGRATE = True TESTING = True diff --git a/setup.py b/setup.py index 598f15f..cc3e751 100755 --- a/setup.py +++ b/setup.py @@ -18,15 +18,15 @@ setup(name='django-notifications-hq', url='http://github.com/django-notifications/django-notifications', install_requires=[ - 'django>=1.4', - 'django-model-utils>=2.0.3,<2.4', + 'django>=1.7', + 'django-model-utils>=2.0.3', 'six>=1.9.0', 'jsonfield>=1.0.3', ], test_requires=[ - 'django>=1.4', - 'django-model-utils>=2.0.3,<2.4', + 'django>=1.7', + 'django-model-utils>=2.0.3', 'six>=1.9.0', 'jsonfield>=1.0.3', 'pytz' @@ -35,7 +35,6 @@ setup(name='django-notifications-hq', packages=['notifications', 'notifications.templatetags', 'notifications.migrations', - 'notifications.south_migrations' ], package_data={'notifications': [ @@ -51,7 +50,6 @@ setup(name='django-notifications-hq', # that you indicate whether you support Python 2, Python 3 or both. 'Programming Language :: Python', 'Programming Language :: Python :: 2', - 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.2', From f0b483089075a1823b2b0d78e5a5992616d9ff98 Mon Sep 17 00:00:00 2001 From: Zhongyuan Date: Mon, 7 Dec 2015 11:24:42 +0800 Subject: [PATCH 02/29] Remove Python 2.6 & Django 1.6 from travis testing; add Python 3.2, 3.5, Django 1.9 --- .travis.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index c28c526..c86a252 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,14 @@ language: python python: - - "2.6" - "2.7" + - "3.2" - "3.3" - "3.4" + - "3.5" env: - - DJANGO=1.6 - DJANGO=1.7 - DJANGO=1.8 + - DJANGO=1.9 install: # command to install dependencies - "pip install coveralls" @@ -19,9 +20,5 @@ script: - coverage run --branch --source=notifications manage.py test matrix: exclude: - - python: "2.6" - env: DJANGO=1.7 - - python: "2.6" - env: DJANGO=1.8 after_success: - coveralls From 3e6861a6cc6356733a146aa3128e448d7d9cfff0 Mon Sep 17 00:00:00 2001 From: Zhongyuan Date: Mon, 7 Dec 2015 15:13:38 +0800 Subject: [PATCH 03/29] Remove support for Python 3.2 as coverage 4 is not supporting it (http://coverage.readthedocs.org/en/coverage-4.0.3/changes.html#version-4-0-20-september-2015) --- .travis.yml | 1 - README.rst | 2 +- setup.py | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index c86a252..5feca37 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,7 +1,6 @@ language: python python: - "2.7" - - "3.2" - "3.3" - "3.4" - "3.5" diff --git a/README.rst b/README.rst index 4613869..67de410 100644 --- a/README.rst +++ b/README.rst @@ -27,7 +27,7 @@ Nomenclature of this specification is based on the Activity Streams Spec: ` Date: Mon, 7 Dec 2015 15:15:54 +0800 Subject: [PATCH 04/29] Remove --use-mirrors from travis, as pip7 doesn't support it --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5feca37..99c4633 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ install: # command to install dependencies - "pip install coveralls" - "pip install pytz" # Needed for tests - - pip install -q Django==$DJANGO --use-mirrors + - pip install -q Django==$DJANGO - "pip install ." # command to run tests script: From 30a3708bf95e83f92c6468dd59fc6bc555502320 Mon Sep 17 00:00:00 2001 From: Zhongyuan Date: Mon, 7 Dec 2015 15:54:07 +0800 Subject: [PATCH 05/29] Temporarily remove Django1.9 from travis, there are still some bugs --- .travis.yml | 1 - README.rst | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 99c4633..01e8ffa 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,6 @@ python: env: - DJANGO=1.7 - DJANGO=1.8 - - DJANGO=1.9 install: # command to install dependencies - "pip install coveralls" diff --git a/README.rst b/README.rst index 67de410..e3477c1 100644 --- a/README.rst +++ b/README.rst @@ -28,7 +28,7 @@ Requirements ============ - Python 2.7, 3.3, 3.4, 3.5 -- Django 1.7, 1.8, 1.9 +- Django 1.7, 1.8 Installation ============ From 8f2aeaa5b6e950a3e99d8e9ffe7808b954703ebd Mon Sep 17 00:00:00 2001 From: Zhongyuan Date: Mon, 7 Dec 2015 16:12:42 +0800 Subject: [PATCH 06/29] Django1.7 doesn't support Python3.5 --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 01e8ffa..925dc5c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,5 +18,7 @@ script: - coverage run --branch --source=notifications manage.py test matrix: exclude: + - python: "3.5" + env: DJANGO=1.7 after_success: - coveralls From 1f0405f701ca076e2c0cb2d06edd0b9103365b40 Mon Sep 17 00:00:00 2001 From: Zhongyuan Date: Mon, 7 Dec 2015 17:34:20 +0800 Subject: [PATCH 07/29] Fix code that incompatible with Django1.8+Python3.5 --- notifications/tests/urls.py | 12 ++++++------ notifications/urls.py | 18 +++++++++--------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/notifications/tests/urls.py b/notifications/tests/urls.py index 48aa629..7d5e3c6 100644 --- a/notifications/tests/urls.py +++ b/notifications/tests/urls.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -from django.conf.urls import include, patterns, url +from django.conf.urls import include, url from django.contrib import admin +from django.contrib.auth.views import login -from notifications import urls -urlpatterns = patterns('', - url(r'^login/$', 'django.contrib.auth.views.login', name='login'), # needed for Django 1.6 tests +urlpatterns = [ + url(r'^login/$', login, name='login'), # needed for Django 1.6 tests url(r'^admin/', include(admin.site.urls)), - url(r'^', include(urls, 'notifications')), -) + url(r'^', include('notifications.urls', namespace='notifications')), +] diff --git a/notifications/urls.py b/notifications/urls.py index f746139..cba58e3 100644 --- a/notifications/urls.py +++ b/notifications/urls.py @@ -1,17 +1,17 @@ # -*- coding: utf-8 -*- -from django.conf.urls import patterns, url +from django.conf.urls import url from . import views -urlpatterns = patterns('notifications.views', +urlpatterns = [ url(r'^$', views.AllNotificationsList.as_view(), name='all'), url(r'^unread/$', views.UnreadNotificationsList.as_view(), name='unread'), - url(r'^mark-all-as-read/$', 'mark_all_as_read', name='mark_all_as_read'), - url(r'^mark-as-read/(?P\d+)/$', 'mark_as_read', name='mark_as_read'), - url(r'^mark-as-unread/(?P\d+)/$', 'mark_as_unread', name='mark_as_unread'), - url(r'^delete/(?P\d+)/$', 'delete', name='delete'), - url(r'^api/unread_count/$', 'live_unread_notification_count', name='live_unread_notification_count'), - url(r'^api/unread_list/$', 'live_unread_notification_list', name='live_unread_notification_list'), -) + url(r'^mark-all-as-read/$', views.mark_all_as_read, name='mark_all_as_read'), + url(r'^mark-as-read/(?P\d+)/$', views.mark_as_read, name='mark_as_read'), + url(r'^mark-as-unread/(?P\d+)/$', views.mark_as_unread, name='mark_as_unread'), + url(r'^delete/(?P\d+)/$', views.delete, name='delete'), + url(r'^api/unread_count/$', views.live_unread_notification_count, name='live_unread_notification_count'), + url(r'^api/unread_list/$', views.live_unread_notification_list, name='live_unread_notification_list'), +] From 2b389592462b4e51077f0e68339896b6b54bd2af Mon Sep 17 00:00:00 2001 From: Sebastian Illing Date: Wed, 9 Dec 2015 14:30:34 +0100 Subject: [PATCH 08/29] django1.9 passing tests again --- .travis.yml | 1 + notifications/__init__.py | 23 +++++++++++++---------- notifications/apps.py | 10 ++++++++++ notifications/tests/__init__.py | 2 +- 4 files changed, 25 insertions(+), 11 deletions(-) create mode 100644 notifications/apps.py diff --git a/.travis.yml b/.travis.yml index 925dc5c..28f01c0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,6 +7,7 @@ python: env: - DJANGO=1.7 - DJANGO=1.8 + - DJANGO=1.9 install: # command to install dependencies - "pip install coveralls" diff --git a/notifications/__init__.py b/notifications/__init__.py index c73842c..e75195a 100644 --- a/notifications/__init__.py +++ b/notifications/__init__.py @@ -1,10 +1,13 @@ -try: - from notifications.signals import notify -except ImportError: - pass - -try: - from notifications.urls import urlpatterns - urls = (urlpatterns, 'notifications', 'notifications') -except ImportError: - pass +default_app_config = 'notifications.apps.Config' +# urls = None +# notify = None +# try: +# from notifications.signals import notify +# except ImportError: +# pass +# +# try: +# from notifications.urls import urlpatterns +# urls = (urlpatterns, 'notifications', 'notifications') +# except ImportError: +# pass diff --git a/notifications/apps.py b/notifications/apps.py new file mode 100644 index 0000000..1652432 --- /dev/null +++ b/notifications/apps.py @@ -0,0 +1,10 @@ +from django.apps import AppConfig + +class Config(AppConfig): + name = "notifications" + + def ready(self): + super(Config, self).ready() + # this is for backwards compability + import notifications.signals + notifications.notify = notifications.signals.notify \ No newline at end of file diff --git a/notifications/tests/__init__.py b/notifications/tests/__init__.py index b8f079e..dbedaef 100644 --- a/notifications/tests/__init__.py +++ b/notifications/tests/__init__.py @@ -1 +1 @@ -from .tests import * \ No newline at end of file +# from .tests import * \ No newline at end of file From 888a59240f34face89d83395144b35fde779195f Mon Sep 17 00:00:00 2001 From: Sebastian Illing Date: Wed, 9 Dec 2015 14:36:16 +0100 Subject: [PATCH 09/29] Update README.rst --- README.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/README.rst b/README.rst index e3477c1..aef297d 100644 --- a/README.rst +++ b/README.rst @@ -1,6 +1,7 @@ ``django-notifications`` Documentation ======================================= + |build-status| |coveralls| `django-notifications `_ is a GitHub notification alike app for Django, it was derived from `django-activity-stream `_ From 243738662b3d56015f813623638efeb021a94111 Mon Sep 17 00:00:00 2001 From: Sebastian Illing Date: Wed, 9 Dec 2015 14:39:07 +0100 Subject: [PATCH 10/29] exclude python3.3,Django1.9 --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 28f01c0..b8bcff3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -21,5 +21,7 @@ matrix: exclude: - python: "3.5" env: DJANGO=1.7 + - python: "3.3" + env: DJANGO=1.9 after_success: - coveralls From 917f2f8831cb1c6eb5f5d39eb0190699978268cb Mon Sep 17 00:00:00 2001 From: Sebastian Illing Date: Wed, 9 Dec 2015 14:41:16 +0100 Subject: [PATCH 11/29] removed old code --- notifications/__init__.py | 13 +------------ notifications/tests/__init__.py | 1 - 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/notifications/__init__.py b/notifications/__init__.py index e75195a..e8a4a4e 100644 --- a/notifications/__init__.py +++ b/notifications/__init__.py @@ -1,13 +1,2 @@ default_app_config = 'notifications.apps.Config' -# urls = None -# notify = None -# try: -# from notifications.signals import notify -# except ImportError: -# pass -# -# try: -# from notifications.urls import urlpatterns -# urls = (urlpatterns, 'notifications', 'notifications') -# except ImportError: -# pass + diff --git a/notifications/tests/__init__.py b/notifications/tests/__init__.py index dbedaef..e69de29 100644 --- a/notifications/tests/__init__.py +++ b/notifications/tests/__init__.py @@ -1 +0,0 @@ -# from .tests import * \ No newline at end of file From e094c15e97ea1d6c677ed52a26ae37409346d29f Mon Sep 17 00:00:00 2001 From: Zhongyuan Date: Thu, 10 Dec 2015 10:50:03 +0800 Subject: [PATCH 12/29] Fix a RemovedInDjango110Warning in unittest --- notifications/tests/settings.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/notifications/tests/settings.py b/notifications/tests/settings.py index d882618..3d9a7d0 100644 --- a/notifications/tests/settings.py +++ b/notifications/tests/settings.py @@ -25,6 +25,22 @@ INSTALLED_APPS = ( ROOT_URLCONF = 'notifications.tests.urls' +TEMPLATES = [ + { + 'BACKEND': 'django.template.backends.django.DjangoTemplates', + 'DIRS': [], + 'APP_DIRS': True, + 'OPTIONS': { + 'context_processors': [ + 'django.template.context_processors.debug', + 'django.template.context_processors.request', + 'django.contrib.auth.context_processors.auth', + 'django.contrib.messages.context_processors.messages', + ], + }, + }, +] + # Need to skip migrations for now as migrations created with python2 break with python3 # See https://code.djangoproject.com/ticket/23455 From 7634dff2905a755690bd2eb04b0dec6be8f8936b Mon Sep 17 00:00:00 2001 From: areski Date: Fri, 11 Dec 2015 14:32:20 +0100 Subject: [PATCH 13/29] Fix Pep8 & use setuptools --- manage.py | 2 +- notifications/__init__.py | 1 - notifications/admin.py | 1 + notifications/apps.py | 5 +- notifications/models.py | 2 +- .../templatetags/notifications_tags.py | 33 +++--- notifications/tests/settings.py | 4 +- notifications/tests/tests.py | 106 +++++++++--------- notifications/utils.py | 2 + notifications/views.py | 1 - setup.py | 67 +++++------ 11 files changed, 109 insertions(+), 115 deletions(-) diff --git a/manage.py b/manage.py index 367aa92..ccc2179 100755 --- a/manage.py +++ b/manage.py @@ -7,4 +7,4 @@ if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "notifications.tests.settings") from django.core.management import execute_from_command_line - execute_from_command_line(sys.argv) \ No newline at end of file + execute_from_command_line(sys.argv) diff --git a/notifications/__init__.py b/notifications/__init__.py index e8a4a4e..41f694b 100644 --- a/notifications/__init__.py +++ b/notifications/__init__.py @@ -1,2 +1 @@ default_app_config = 'notifications.apps.Config' - diff --git a/notifications/admin.py b/notifications/admin.py index a2cc972..cefc9f2 100644 --- a/notifications/admin.py +++ b/notifications/admin.py @@ -3,6 +3,7 @@ from django.contrib import admin from .models import Notification + class NotificationAdmin(admin.ModelAdmin): list_display = ('recipient', 'actor', 'level', 'target', 'unread', 'public') diff --git a/notifications/apps.py b/notifications/apps.py index 1652432..f7e6f6c 100644 --- a/notifications/apps.py +++ b/notifications/apps.py @@ -1,10 +1,11 @@ from django.apps import AppConfig + class Config(AppConfig): name = "notifications" def ready(self): super(Config, self).ready() # this is for backwards compability - import notifications.signals - notifications.notify = notifications.signals.notify \ No newline at end of file + import notifications.signals + notifications.notify = notifications.signals.notify diff --git a/notifications/models.py b/notifications/models.py index 5b60ec1..85d1759 100644 --- a/notifications/models.py +++ b/notifications/models.py @@ -212,7 +212,7 @@ class Notification(models.Model): return u'%(actor)s %(verb)s %(action_object)s %(timesince)s ago' % ctx return u'%(actor)s %(verb)s %(timesince)s ago' % ctx - def __str__(self):#Adds support for Python 3 + def __str__(self): # Adds support for Python 3 return self.__unicode__() def timesince(self, now=None): diff --git a/notifications/templatetags/notifications_tags.py b/notifications/templatetags/notifications_tags.py index 4cbc6f5..1399685 100644 --- a/notifications/templatetags/notifications_tags.py +++ b/notifications/templatetags/notifications_tags.py @@ -1,11 +1,10 @@ # -*- coding: utf-8 -*- from django.core.urlresolvers import reverse from django.template import Library -from django.template.base import TemplateSyntaxError -from django.template import Node register = Library() + @register.assignment_tag(takes_context=True) def notifications_unread(context): user = user_context(context) @@ -13,26 +12,26 @@ def notifications_unread(context): return '' return user.notifications.unread().count() + # Requires vanilla-js framework - http://vanilla-js.com/ @register.simple_tag -def register_notify_callbacks(badge_id='live_notify_badge',menu_id='live_notify_list',refresh_period=15,callbacks="",api_name='list'): - refresh_period=int(refresh_period)*1000 +def register_notify_callbacks(badge_id='live_notify_badge',menu_id='live_notify_list', refresh_period=15,callbacks="",api_name='list'): + refresh_period = int(refresh_period)*1000 - if api_name=='list': + if api_name == 'list': api_url = reverse('notifications:live_unread_notification_list') - elif api_name=='count': + elif api_name == 'count': api_url = reverse('notifications:live_unread_notification_count') else: return "" - - definitions=""" + definitions = """ notify_badge_id='{badge_id}'; notify_menu_id='{menu_id}'; notify_api_url='{api_url}'; notify_unread_url='{unread_url}'; notify_mark_all_unread_url='{mark_all_unread_url}'; - notify_refresh_period={refresh};""".format(badge_id=badge_id,menu_id=menu_id,refresh=refresh_period,api_url=api_url,unread_url=reverse('notifications:unread'),mark_all_unread_url=reverse('notifications:mark_all_as_read')) - + notify_refresh_period={refresh};""".format(badge_id=badge_id, menu_id=menu_id, refresh=refresh_period, api_url=api_url, unread_url=reverse('notifications:unread'), mark_all_unread_url=reverse('notifications:mark_all_as_read')) + script = "