pushnotifications package

Submodules

pushnotifications.admin module

The admin interfaces registered by the pushnotifications package

class pushnotifications.admin.DeviceAdmin(model, admin_site)[source]

Bases: django.contrib.admin.options.ModelAdmin

Manage the devices

actions = ('enable', 'disable')
disable(request, queryset)[source]
enable(request, queryset)[source]
list_display = ('name', 'type', 'active', 'date_created')
list_filter = ('active', 'type')
property media
name(obj)[source]
ordering = ('user__first_name',)
search_fields = ('registration_id', 'user__username', 'user__first_name', 'user__last_name')
class pushnotifications.admin.MessageAdmin(model, admin_site)[source]

Bases: utils.translation.TranslatedModelAdmin

Manage normal messages

change_view(request, object_id, form_url='', **kwargs)[source]
date_hierarchy = 'sent'
exclude = None
fields = None
filter_horizontal = ('users',)
get_fields(request, obj=None)[source]

Hook for specifying fields.

get_readonly_fields(request, obj=None)[source]

Hook for specifying custom readonly fields.

list_display = ('title', 'body', 'category', 'url', 'sent', 'success', 'failure')
list_filter = (<class 'pushnotifications.admin.MessageSentFilter'>, 'category')
property media
search_fields = ()
class pushnotifications.admin.MessageSentFilter(request, params, model, model_admin)[source]

Bases: django.contrib.admin.filters.SimpleListFilter

Filter the push notifications on whether they are sent or not

lookups(request, model_admin)[source]

Must be overridden to return a list of tuples (value, verbose value)

parameter_name = 'is_sent'
queryset(request, queryset)[source]

Return the filtered queryset.

title = 'sent'
class pushnotifications.admin.ScheduledMessageAdmin(model, admin_site)[source]

Bases: utils.translation.TranslatedModelAdmin

Manage scheduled messages

date_hierarchy = 'time'
exclude = None
fields = None
filter_horizontal = ('users',)
get_fields(request, obj=None)[source]

Hook for specifying fields.

get_readonly_fields(request, obj=None)[source]

Hook for specifying custom readonly fields.

list_display = ('title', 'body', 'time', 'category', 'sent', 'success', 'failure')
list_filter = (<class 'pushnotifications.admin.MessageSentFilter'>, 'category')
property media
search_fields = ()

pushnotifications.apps module

Configuration for the pushnotifications package

class pushnotifications.apps.PushNotificationsConfig(app_name, app_module)[source]

Bases: django.apps.config.AppConfig

AppConfig for the pushnotifications package

name = 'pushnotifications'
verbose_name = 'Push Notifications'

pushnotifications.models module

The models defined by the pushnotifications package

class pushnotifications.models.Category(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Describes a Message category

BOARD = 'board'
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

EVENT = 'event'
GENERAL = 'general'
exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

NEWSLETTER = 'newsletter'
PARTNER = 'partner'
PHOTO = 'photo'
PIZZA = 'pizza'
property description

Accessor that fetches the localized variant of description

description_en

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

description_nl

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

device_set

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

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

key

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

message_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.

property name

Accessor that fetches the localized variant of name

name_en

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

name_nl

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

objects = <django.db.models.manager.Manager object>
class pushnotifications.models.Device(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Describes a device

DEVICE_TYPES = (('ios', 'iOS'), ('android', 'Android'))
exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

active

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

date_created

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

get_language_display(*, field=<django.db.models.fields.CharField: language>)
get_next_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=True, **kwargs)
get_previous_by_date_created(*, field=<django.db.models.fields.DateTimeField: date_created>, is_next=False, **kwargs)
get_type_display(*, field=<django.db.models.fields.CharField: type>)
id

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

language

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

objects = <django.db.models.manager.Manager object>
receive_category

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

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

registration_id

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

type

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

user

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

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

Child.parent is a ForwardManyToOneDescriptor instance.

user_id
class pushnotifications.models.Message(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Describes a push notification

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

all_objects = <pushnotifications.models.MessageManager object>
property body

Accessor that fetches the localized variant of body

body_en

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

body_nl

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

category

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

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

Child.parent is a ForwardManyToOneDescriptor instance.

category_id
failure

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

id

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

objects = <pushnotifications.models.NormalMessageManager object>
scheduledmessage

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

send(**kwargs)[source]
sent

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

success

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

property title

Accessor that fetches the localized variant of title

title_en

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

title_nl

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

url

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

users

Accessor to the related objects manager on the forward and reverse sides of a many-to-many relation.

In the example:

class Pizza(Model):
    toppings = ManyToManyField(Topping, related_name='pizzas')

Pizza.toppings and Topping.pizzas are ManyToManyDescriptor instances.

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

class pushnotifications.models.MessageManager(*args, **kwargs)[source]

Bases: django.db.models.manager.Manager

Returns all messages

get_queryset()[source]

Return a new QuerySet object. Subclasses can override this method to customize the behavior of the Manager.

class pushnotifications.models.NormalMessageManager(*args, **kwargs)[source]

Bases: django.db.models.manager.Manager

Returns manual messages only

get_queryset()[source]

Return a new QuerySet object. Subclasses can override this method to customize the behavior of the Manager.

class pushnotifications.models.ScheduledMessage(*args, **kwargs)[source]

Bases: pushnotifications.models.Message

Describes a scheduled push notification

exception DoesNotExist

Bases: pushnotifications.models.Message.DoesNotExist

exception MultipleObjectsReturned

Bases: pushnotifications.models.Message.MultipleObjectsReturned

album_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.

executed

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

get_next_by_time(*, field=<django.db.models.fields.DateTimeField: time>, is_next=True, **kwargs)
get_previous_by_time(*, field=<django.db.models.fields.DateTimeField: time>, is_next=False, **kwargs)
message_ptr

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

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Restaurant.place is a ForwardOneToOneDescriptor instance.

message_ptr_id
objects = <pushnotifications.models.ScheduledMessageManager object>
pizzaevent

Accessor to the related object on the reverse side of a one-to-one relation.

In the example:

class Restaurant(Model):
    place = OneToOneField(Place, related_name='restaurant')

Place.restaurant is a ReverseOneToOneDescriptor instance.

registration_event

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.

scheduled

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

start_event

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.

time

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

class pushnotifications.models.ScheduledMessageManager(*args, **kwargs)[source]

Bases: django.db.models.manager.Manager

Returns scheduled messages only

get_queryset()[source]

Return a new QuerySet object. Subclasses can override this method to customize the behavior of the Manager.

pushnotifications.models.default_receive_category()[source]

pushnotifications.urls module

“The routes defined by the pushnotifications package

pushnotifications.views module

Views provided by the pushnotifications package

pushnotifications.views.admin_send(request, pk)[source]

Send the provided push notification

Parameters
  • request – the request

  • pk – key of the message

Returns

redirect 304 to the overview of notifications