notifications package

Contents

notifications package#

Subpackages#

Submodules#

notifications.admin module#

Generated by utils/cgit/cgit_util_generate_admin_file on 2022-01-24 14:43:25.002243

class notifications.admin.AbstractEmailAdmin(model, admin_site)[source]#

Bases: ModelAdmin

Admin class for model AbstractEmail

autocomplete_fields = ['member', 'sender']#
property media#
class notifications.admin.BatchIDAdmin(model, admin_site)[source]#

Bases: ModelAdmin

Admin class for model BatchID

property media#
search_fields = ['batch_id']#
class notifications.admin.BlockNotificationAdmin(model, admin_site)[source]#

Bases: ModelAdmin

Admin class for model BlockNotification

autocomplete_fields = ['member']#
property media#
class notifications.admin.EmailAttachmentAdmin(model, admin_site)[source]#

Bases: ModelAdmin

Admin class for model EmailAttachment

autocomplete_fields = ['member', 'organisation']#
property media#
search_fields = ('member', 'organisation')#
class notifications.admin.EmailBatchRBACAdmin(model, admin_site)[source]#

Bases: ModelAdmin

Admin class for model EmailBatchRBAC

autocomplete_fields = ['batch_id', 'meta_sender', 'meta_organisation']#
property media#
class notifications.admin.InAppNotificationAdmin(model, admin_site)[source]#

Bases: ModelAdmin

Admin class for model InAppNotification

autocomplete_fields = ['member']#
property media#
search_fields = ('member',)#
class notifications.admin.NotificationMappingAdmin(model, admin_site)[source]#

Bases: ModelAdmin

Admin class for model NotificationMapping

autocomplete_fields = ['member']#
property media#
search_fields = ('member',)#
class notifications.admin.RealtimeNotificationAdmin(model, admin_site)[source]#

Bases: ModelAdmin

Admin class for model RealtimeNotification

autocomplete_fields = ['header', 'member', 'admin']#
property media#
search_fields = ('member__first_name', 'member__last_name')#
class notifications.admin.RealtimeNotificationHeaderAdmin(model, admin_site)[source]#

Bases: ModelAdmin

Admin class for model RealtimeNotificationHeader

autocomplete_fields = ['admin']#
property media#
search_fields = ('admin',)#
class notifications.admin.SnooperAdmin(model, admin_site)[source]#

Bases: ModelAdmin

Admin class for model Snooper

autocomplete_fields = ['batch_id']#
property media#
class notifications.admin.UnregisteredBlockedEmailAdmin(model, admin_site)[source]#

Bases: ModelAdmin

Admin class for model UnregisteredBlockedEmail

autocomplete_fields = ['un_registered_user']#
property media#

notifications.apis module#

notifications.apis.fcm_token_get_user_v1(fcm_token)[source]#

Helper function to validate an FCM token

Parameters:

fcm_token – str. FCM token usually passed from mobile client. Not trusted.

Returns:

either a valid user associated with this token or False return_error_code (int or None): if user is invalid this will be the return code return_error_msg_structure (struct or None): if user is invalid this will be the return structure (StatusResponseV1)

Return type:

user(User)

notifications.apis.notifications_api_file_upload_v1(request, file, sender_identification=None)[source]#

API call to upload a file and send SMS messages

notifications.apis.notifications_api_latest_messages_for_user_v1(fcm_token)[source]#

Send latest notifications (FCM) for a user regardless if read or not

notifications.apis.notifications_api_unread_messages_for_user_v1(fcm_token)[source]#

Send any unread notifications (FCM) for a user

notifications.apis.notifications_delete_all_messages_for_user_v1(data)[source]#

Delete all messages for a user

notifications.apis.notifications_delete_message_for_user_v1(data)[source]#

Delete a single message

notifications.apps module#

class notifications.apps.NotificationsConfig(app_name, app_module)[source]#

Bases: AppConfig

This uses the ready() function of AppConfig to register to handle signals for Django SES. It has to do this because we need Django to be ready before we can register them.

Signals are a bit of a nasty way to do things but are the only way to get notified by Django SES that we have an incoming event to handle.

There is one handler per event - send, deliver, open, click, bounce, complaint

There is a weird problem where it won’t work unless DEBUG is on. It seems that within Django in dispatch/dispatcher.py in the function connect, if DEBUG is true then it tries to check that the receiver (us) accepts kwargs (we do). Without this check Django SES doesn’t call us. To get around this, we call the same function that connect calls - func_accepts_kwargs once for each receiving function.

name = 'notifications'#
ready()[source]#

Called when Django starts up

For more information look in the docs at notifications_overview

This handles the signals from django-ses when notifications are received from SES.

notifications.forms module#

class notifications.forms.EmailAttachmentForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]#

Bases: ModelForm

Form for uploading an attachment for a club

class Meta[source]#

Bases: object

fields = ('attachment',)#
model#

alias of EmailAttachment

widgets = {'attachment': <django.forms.widgets.FileInput object>}#
base_fields = {'attachment': <django.forms.fields.FileField object>}#
declared_fields = {}#
property media#

Return all media required to render the widgets on this form.

class notifications.forms.EmailContactForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None, bound_field_class=None)[source]#

Bases: Form

Contact a member

base_fields = {'message': <django.forms.fields.CharField object>, 'redirect_to': <django.forms.fields.CharField object>, 'title': <django.forms.fields.CharField object>}#
declared_fields = {'message': <django.forms.fields.CharField object>, 'redirect_to': <django.forms.fields.CharField object>, 'title': <django.forms.fields.CharField object>}#
property media#

Return all media required to render the widgets on this form.

class notifications.forms.EmailContentForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None, bound_field_class=None)[source]#

Bases: Form

Form to get email content (compose email step 3)

base_fields = {'email_body': <django.forms.fields.CharField object>, 'subject': <django.forms.fields.CharField object>}#
clean_body()[source]#
declared_fields = {'email_body': <django.forms.fields.CharField object>, 'subject': <django.forms.fields.CharField object>}#
property media#

Return all media required to render the widgets on this form.

class notifications.forms.EmailOptionsForm(*args, **kwargs)[source]#

Bases: Form

Form to get email options (compose email step 2)

base_fields = {'from_name': <django.forms.fields.CharField object>, 'reply_to': <django.forms.fields.EmailField object>, 'template': <django.forms.fields.ChoiceField object>}#
clean_body()[source]#
declared_fields = {'from_name': <django.forms.fields.CharField object>, 'reply_to': <django.forms.fields.EmailField object>, 'template': <django.forms.fields.ChoiceField object>}#
property media#

Return all media required to render the widgets on this form.

class notifications.forms.MemberToMemberEmailForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, field_order=None, use_required_attribute=None, renderer=None, bound_field_class=None)[source]#

Bases: Form

Contact a member

base_fields = {'message': <django.forms.fields.CharField object>, 'redirect_to': <django.forms.fields.CharField object>, 'subject': <django.forms.fields.CharField object>}#
declared_fields = {'message': <django.forms.fields.CharField object>, 'redirect_to': <django.forms.fields.CharField object>, 'subject': <django.forms.fields.CharField object>}#
property media#

Return all media required to render the widgets on this form.

class notifications.forms.OrgEmailForm(*args, **kwargs)[source]#

Bases: Form

Form to send an email using a template. This form doesn’t include who to send it to, that is specific to the use of the form and needs to be handled separately

base_fields = {'from_name': <django.forms.fields.CharField object>, 'org_email_body': <django.forms.fields.CharField object>, 'reply_to': <django.forms.fields.EmailField object>, 'subject': <django.forms.fields.CharField object>, 'template': <django.forms.fields.ChoiceField object>}#
clean_body()[source]#
declared_fields = {'from_name': <django.forms.fields.CharField object>, 'org_email_body': <django.forms.fields.CharField object>, 'reply_to': <django.forms.fields.EmailField object>, 'subject': <django.forms.fields.CharField object>, 'template': <django.forms.fields.ChoiceField object>}#
property media#

Return all media required to render the widgets on this form.

notifications.models module#

class notifications.models.AbstractEmail(*args, **kwargs)[source]#

Bases: Model

Stores emails so that the sending of emails is decoupled from their production. This is needed as there can be delays sending email which affect client responsiveness. See the documentation for more information especially around setting up the system so that emails get sent and don’t sit in the queue forever. This Abstract class is made concrete as Email and EmailArchive.

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

batch_id#

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

created_date#

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

email#

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.

emailarchive#

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.

get_next_by_created_date(*, field=<django.db.models.fields.DateTimeField: created_date>, is_next=True, **kwargs)#
get_previous_by_created_date(*, field=<django.db.models.fields.DateTimeField: created_date>, is_next=False, **kwargs)#
get_status_display(*, field=<django.db.models.fields.CharField: status>)#
id#

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

member#

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.

member_id#
message#

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>#
recipient#

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

reply_to#

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

sender#

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.

sender_id#
sent_date#

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

status#

We only use two states. If a message has been queued but not sent then it will get picked up later and sent, even if the code that queued it crashes before it can issue the send() request.

subject#

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

class notifications.models.BatchActivity(*args, **kwargs)[source]#

Bases: Model

The activities (series, congresses, events) associated with an entrant email batch

ACTIVITY_TYPE = [('S', 'Series'), ('C', 'Congress'), ('E', 'Event')]#
ACTIVITY_TYPE_CONGRESS = 'C'#
ACTIVITY_TYPE_EVENT = 'E'#
ACTIVITY_TYPE_SERIES = 'S'#
exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

activity_id#

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

activity_type#

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

batch#

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.

batch_id#
get_activity_type_display(*, field=<django.db.models.fields.CharField: activity_type>)#
id#

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 notifications.models.BatchAttachment(*args, **kwargs)[source]#

Bases: Model

An attachment for a batch email

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

attachment#

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.

attachment_id#
batch#

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.

batch_id#
id#

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 notifications.models.BatchContent(*args, **kwargs)[source]#

Bases: Model

The email body for a batch email

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

batch#

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.

batch_id#
email_body#

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 = <django.db.models.manager.Manager object>#
class notifications.models.BatchID(*args, **kwargs)[source]#

Bases: Model

Simple model for unique batch ids

sprint-48: Expanded to include batch header information to suppprt email batch list view, and re-entrant batch editing. Really should be renamed Batch or BatchHeader as no longer just the batch id.

BATCH_STATE = [('WIP', 'In progress'), ('INF', 'Being Sent'), ('ERR', 'Errored'), ('CMP', 'Complete')]#
BATCH_STATE_COMPLETE = 'CMP'#
BATCH_STATE_ERRORED = 'ERR'#
BATCH_STATE_IN_FLIGHT = 'INF'#
BATCH_STATE_WIP = 'WIP'#
BATCH_TYPE = [('ADM', 'Admin'), ('COM', 'Comms'), ('CNG', 'Congress'), ('EVT', 'Event'), ('MBR', 'Member'), ('MLT', 'Multi-event'), ('RES', 'Results'), ('ENT', 'Entry'), ('UNK', 'Unknown')]#
BATCH_TYPE_ADMIN = 'ADM'#
BATCH_TYPE_COMMS = 'COM'#
BATCH_TYPE_CONGRESS = 'CNG'#
BATCH_TYPE_ENTRY = 'ENT'#
BATCH_TYPE_EVENT = 'EVT'#
BATCH_TYPE_MEMBER = 'MBR'#
BATCH_TYPE_MULTI = 'MLT'#
BATCH_TYPE_RESULTS = 'RES'#
BATCH_TYPE_UNKNOWN = 'UNK'#
exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

activities#

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.

attachments#

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.

batch_id#

Batch id links emails together and controls security

batch_size#

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

batch_type#

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

batchcontent#

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.

property complete#

Has the batch been queued for delivery

create_new()[source]#

create a new batch id

created#

create DTS until sent, then should be updated with the sent DTS

date_range_from#

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

date_range_to#

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

description#

A meaningful description when created, but should ultimately be the subject line

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

from_name#

A from name string that overrides the template value

get_batch_type_display(*, field=<django.db.models.fields.CharField: batch_type>)#
get_next_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=True, **kwargs)#
get_previous_by_created(*, field=<django.db.models.fields.DateTimeField: created>, is_next=False, **kwargs)#
get_state_display(*, field=<django.db.models.fields.CharField: state>)#
id#

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>#
organisation#

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.

organisation_id#
recipients#

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.

reply_to#

A reply to address that overrides the template value

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

state#

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

template#

The club template to be used. Note could be deleted out from under this record

template_id#
class notifications.models.BlockNotification(*args, **kwargs)[source]#

Bases: Model

This is the opposite of what notifications originally did. This maintains a list of things that a user does not want to be told about. Originally this was built for conveners who do not want email notifications.

Setting model_id to None and identifier to either CONVENER_EMAIL_BY_EVENT or CONVENER_EMAIL_BY_ORG has the same effect, it stops you getting notified about anything related to any event. To turn this off use CONVENER_EMAIL_BY_EVENT set to None so the admin function will work. Changing this manually through Django admin is not recommended.

exception DoesNotExist#

Bases: ObjectDoesNotExist

class Identifier(*values)[source]#

Bases: TextChoices

CONVENER_EMAIL_BY_EVENT = 'CE'#
CONVENER_EMAIL_BY_ORG = 'CO'#
exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

get_identifier_display(*, field=<django.db.models.fields.CharField: identifier>)#
id#

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

identifier#

One of the enum values, eg CONVENER_EMAIL_BY_EVENT

member#

User who doesn’t want notified

member_id#
model_id#

Specific model_id to block. None to block everything

objects = <django.db.models.manager.Manager object>#
class notifications.models.Email(id, subject, message, status, batch_id, recipient, reply_to, member, sender, created_date, sent_date, abstractemail_ptr)[source]#

Bases: AbstractEmail

exception DoesNotExist#

Bases: DoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

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

abstractemail_ptr_id#
class notifications.models.EmailArchive(id, subject, message, status, batch_id, recipient, reply_to, member, sender, created_date, sent_date, abstractemail_ptr)[source]#

Bases: AbstractEmail

exception DoesNotExist#

Bases: DoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

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

abstractemail_ptr_id#
class notifications.models.EmailAttachment(*args, **kwargs)[source]#

Bases: Model

Email attachments. Can be owned by a user or an organisation. Attachments are loaded into the media directory and are public. Attachments should not be used for anything secure.

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

attachment#

The descriptor for the file attribute on the model instance. Return a FieldFile when accessed so you can write code like:

>>> from myapp.models import MyModel
>>> instance = MyModel.objects.get(pk=1)
>>> instance.file.size

Assign a file object on assignment so you can do:

>>> with open('/path/to/hello.world') as f:
...     instance.file = File(f)
batches#

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.

created_at#

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

filename()[source]#
get_next_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=True, **kwargs)#
get_previous_by_created_at(*, field=<django.db.models.fields.DateTimeField: created_at>, is_next=False, **kwargs)#
id#

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

member#

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.

member_id#
objects = <django.db.models.manager.Manager object>#
organisation#

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.

organisation_id#
class notifications.models.EmailBatchRBAC(*args, **kwargs)[source]#

Bases: Model

Control who can access a batch of emails.

By default, only the global admin group can see an email, this allows specific RBAC roles to be granted access.

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

batch_id#

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.

batch_id_id#
id#

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

meta_organisation#

Org who sent this

meta_organisation_id#
meta_sender#

User who sent this. Also used for member to member emails to be the user who it was sent to. Sorry.

meta_sender_id#
objects = <django.db.models.manager.Manager object>#
rbac_role#

rbac role to view this batch of emails

class notifications.models.EmailThread(*args, **kwargs)[source]#

Bases: Model

Used to keep track of running threads

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

created_date#

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_created_date(*, field=<django.db.models.fields.DateTimeField: created_date>, is_next=True, **kwargs)#
get_previous_by_created_date(*, field=<django.db.models.fields.DateTimeField: created_date>, is_next=False, **kwargs)#
id#

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 notifications.models.InAppNotification(*args, **kwargs)[source]#

Bases: Model

Temporary storage for notification messages.

Stores any event that a Cobalt module wants to notify a user about.

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

acknowledged#

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

created_date#

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_created_date(*, field=<django.db.models.fields.DateTimeField: created_date>, is_next=True, **kwargs)#
get_previous_by_created_date(*, field=<django.db.models.fields.DateTimeField: created_date>, is_next=False, **kwargs)#
id#

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

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

member#

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.

member_id#
message#

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 notifications.models.NotificationMapping(*args, **kwargs)[source]#

Bases: Model

Stores mappings of users to events and actions

APPLICATION_NAMES = [('Forums', 'Forums'), ('Payments', 'Payments')]#
exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

NOTIFICATION_TYPES = [('SMS', 'SMS Message'), ('Email', 'Email Message')]#
application#

Cobalt application name

event_type#

Event type as set by the application. eg. forum.post.new

get_application_display(*, field=<django.db.models.fields.CharField: application>)#
get_notification_type_display(*, field=<django.db.models.fields.CharField: notification_type>)#
id#

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

member#

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.

member_id#
notification_type#

How to notify the member

objects = <django.db.models.manager.Manager object>#
subtopic#

Level 2 event in application

topic#

Level 1 event in application

class notifications.models.RealtimeNotification(*args, **kwargs)[source]#

Bases: Model

Logging for realtime notifications such as SMS or in app messages to phones

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

admin#

Admin who sent the message

admin_id#
aws_message_id#

AWS message id from SMS call

created_time#

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

fcm_device#

Optional device for FCM

fcm_device_id#
get_next_by_created_time(*, field=<django.db.models.fields.DateTimeField: created_time>, is_next=True, **kwargs)#
get_previous_by_created_time(*, field=<django.db.models.fields.DateTimeField: created_time>, is_next=False, **kwargs)#
has_been_read#

Whether message has been read or not by the client app. For SMS we don’t know so this is always false

header#

Optional header record with meta data

header_id#
id#

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

member#

Member who received the message

member_id#
msg#

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>#
status#

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

class notifications.models.RealtimeNotificationHeader(*args, **kwargs)[source]#

Bases: Model

Optional meta data about RealtimeNotification for use when an administrator sends a batch of messages such as the results of a round of an event.

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

admin#

Admin who sent the message

admin_id#
attempted_send_number#

Number of users we tried to contact. Total - invalid

created_time#

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

description#

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

get_invalid_lines()[source]#

Convert string to list to load

get_next_by_created_time(*, field=<django.db.models.fields.DateTimeField: created_time>, is_next=True, **kwargs)#
get_previous_by_created_time(*, field=<django.db.models.fields.DateTimeField: created_time>, is_next=False, **kwargs)#
get_uncontactable_users()[source]#

Convert string to list to load

get_unregistered_users()[source]#

Convert string to list to load

id#

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

invalid_lines#

List of invalid lines in the upload file

objects = <django.db.models.manager.Manager object>#
realtimenotification_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.

send_status#

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

sender_identification#

Used to identify the actual sender, e.g. for CS3 Peter Busch uses his token, but this holds the CS3 licence no

set_invalid_lines(data)[source]#

Convert list to string to save

set_uncontactable_users(data)[source]#

Convert list to string to save

set_unregistered_users(data)[source]#

Convert list to string to save

successful_send_number#

How many we think we managed to send

total_record_number#

Used for file uploads. Total number of records received through API

uncontactable_users#

List of users we couldn’t send to as they aren’t set up for it. JSON stored as string

unregistered_users#

List of users we couldn’t send to as they are unregistered. JSON stored as string

class notifications.models.Recipient(*args, **kwargs)[source]#

Bases: Model

Temporary store of recipients for a batch email

A point in time record of a recipient’s details. To be deleted once the batch has been sent.

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

batch#

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.

batch_id#
create_from_user(batch, user, initial=True)[source]#

Initialise with the user’s details

email#

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

first_name#

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

property full_name#

Full name, including if first name is ommitted or first name is TBA

id#

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

include#

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

initial#

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

last_name#

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

property name_and_number#

Name and system number if supplied (otherwise add email)

objects = <django.db.models.manager.Manager object>#
system_number#

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

class notifications.models.Snooper(*args, **kwargs)[source]#

Bases: Model

Stores information from AWS SES about activity with Email

Also stores the batch id associated with this email which controls who sent it and who can access it.

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

batch_id#

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.

batch_id_id#
limited_notifications#

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>#
post_office_email#

Link to the email in Django Post Office

post_office_email_id#
ses_bounce_reason#

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

ses_clicked_count#

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

ses_delivered_at#

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

ses_last_bounce_at#

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

ses_last_clicked_at#

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

ses_last_opened_at#

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

ses_open_count#

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

ses_sent_at#

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

class notifications.models.UnregisteredBlockedEmail(*args, **kwargs)[source]#

Bases: Model

This is for privacy. We allow unregistered users to control whether we send to them or not.

Any entry here will block sending to this email address.

exception DoesNotExist#

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned#

Bases: MultipleObjectsReturned

email#

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 = <django.db.models.manager.Manager object>#
un_registered_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.

un_registered_user_id#

notifications.urls module#

Module contents#