mailinglists package

Submodules

mailinglists.admin module

The admin interfaces registered by the mailinglists package

class mailinglists.admin.ListAliasInline(parent_model, admin_site)[source]

Bases: django.contrib.admin.options.TabularInline

Class to inline show the ListAlias.

property media
model

alias of mailinglists.models.ListAlias

class mailinglists.admin.MailingListAdmin(model, admin_site)[source]

Bases: django.contrib.admin.options.ModelAdmin

Class to show the mailing lists in the admin.

alias_names(obj)[source]

Return list of aliases of obj.

filter_horizontal = ('members',)
inlines = (<class 'mailinglists.admin.VerbatimAddressInline'>, <class 'mailinglists.admin.ListAliasInline'>)
list_display = ('name', 'alias_names', 'moderated', 'description')
property media
search_fields = ['name', 'aliases__alias']
class mailinglists.admin.VerbatimAddressInline(parent_model, admin_site)[source]

Bases: django.contrib.admin.options.TabularInline

Class to inline show the VerbatimAddress.

property media
model

alias of mailinglists.models.VerbatimAddress

mailinglists.apps module

Configuration for the mailinglists package

class mailinglists.apps.MailinglistsConfig(app_name, app_module)[source]

Bases: django.apps.config.AppConfig

Appconfig for mailinglist app.

name = 'mailinglists'
ready()[source]

Imports the signals when the app is ready

verbose_name = 'Mailing lists'

mailinglists.gsuite module

GSuite syncing helpers defined by the mailinglists package

class mailinglists.gsuite.GSuiteSyncService(groups_settings_api=<googleapiclient.discovery.Resource object>, directory_api=<googleapiclient.discovery.Resource object>)[source]

Bases: object

class GroupData(name, description='', moderated=False, aliases=(), addresses=())[source]

Bases: object

create_group(group)[source]

Create a new group based on the provided data :param group: group data

delete_group(name: str)[source]

Set the specified list to unused, this is not a real delete :param name: Group name

static mailinglist_to_group(mailinglist: mailinglists.models.MailingList)[source]

Convert a mailinglist model to everything we need for GSuite

sync_mailinglists(lists: List[mailinglists.gsuite.GSuiteSyncService.GroupData] = None)[source]

Sync mailing lists with GSuite :param lists: optional parameter to determine which lists to sync

update_group(old_name, group)[source]

Update a group based on the provided name and data :param old_name: old group name :param group: new group data

mailinglists.models module

The models defined by the mailinglists package

class mailinglists.models.ListAlias(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Model describing an alias of a mailing list.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

alias

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

clean()[source]

Validate the alias.

id

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

mailinglist

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.

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

Bases: django.db.models.base.Model

Model describing mailing lists.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

addresses

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.

aliases

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.

all_addresses()[source]

Return all addresses subscribed to this mailing list.

clean()[source]

Validate the mailing list.

description

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.

member_groups

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.

membergroup

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.

members

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.

moderated

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

name

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 mailinglists.models.VerbatimAddress(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Model that describes an email address subscribed to a mailing list.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

address

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.

mailinglist

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.

mailinglist_id
objects = <django.db.models.manager.Manager object>
mailinglists.models.get_automatic_mailinglists()[source]

Return mailing list names that should be generated automatically.

mailinglists.services module

The services defined by the mailinglists package

mailinglists.services.get_automatic_lists()[source]

Return list of mailing lists that should be generated automatically.

mailinglists.services.get_member_email_addresses(member)[source]

mailinglists.signals module

mailinglists.signals.pre_mailinglist_save(instance, **kwargs)[source]