notification.models module

class notification.models.Inbox(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Inbox notifications are stored in this model until users read them. Once read, inbox notifications are deleted. Moreover, inbox notification have an expire time. After that, they’ll be automatically removed by Django.

Parameters:
  • id (AutoField) – Id
  • user_id (ForeignKey) – User
  • notification_id (ForeignKey) – Notification
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Inbox.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Inbox.expired()[source]
Inbox.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Inbox.notification

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Inbox.notification_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Inbox.objects = <django.db.models.manager.Manager object>
Inbox.user

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

Inbox.user_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class notification.models.Notification(*args, **kwargs)[source]

Bases: django.db.models.base.Model

This model represents a notification on the database.

Parameters:
  • id (AutoField) – Id
  • payload (JSONField) – Payload
  • level (IntegerField) – Level
  • date (DateTimeField) – Date
  • tag (CharField) – Tag
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception Notification.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

Notification.date

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Notification.get_next_by_date(*moreargs, **morekwargs)
Notification.get_previous_by_date(*moreargs, **morekwargs)
Notification.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Notification.inbox_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Notification.level

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

Notification.notificationarchive_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

Notification.objects = <django.db.models.manager.Manager object>
Notification.payload

A placeholder class that provides a way to set the attribute on the model.

Notification.serialize_to_json()[source]
Notification.tag

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

class notification.models.NotificationArchive(*args, **kwargs)[source]

Bases: django.db.models.base.Model

This model holds all the notifications that users received.

Parameters:
  • id (AutoField) – Id
  • user_id (ForeignKey) – User
  • notification_id (ForeignKey) – Notification
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception NotificationArchive.MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

NotificationArchive.id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

NotificationArchive.notification

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

NotificationArchive.notification_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

NotificationArchive.objects = <django.db.models.manager.Manager object>
NotificationArchive.user

Accessor to the related object on the forward side of a many-to-one or one-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

child.parent is a ForwardManyToOneDescriptor instance.

NotificationArchive.user_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.