activemembers package

Submodules

activemembers.admin module

Registers admin interfaces for the activemembers module.

class activemembers.admin.ActiveMembershipsFilter(request, params, model, model_admin)[source]

Bases: django.contrib.admin.filters.SimpleListFilter

Filter the memberships by whether they are active or not.

lookups(request, model_admin)[source]

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

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

Return the filtered queryset.

title = 'active memberships'
class activemembers.admin.BoardAdmin(model, admin_site)[source]

Bases: django.contrib.admin.options.ModelAdmin

Manage the board.

exclude = ('is_board',)
fields = ('name', 'description', 'photo', 'permissions', 'contact_mailinglist', 'contact_email', 'since', 'until', 'display_members')
filter_horizontal = ('permissions',)
form

alias of activemembers.forms.MemberGroupForm

inlines = (<class 'activemembers.admin.MemberGroupMembershipInline'>,)
property media
class activemembers.admin.CommitteeAdmin(model, admin_site)[source]

Bases: activemembers.admin.MemberGroupAdmin

Manage the committees.

property media
class activemembers.admin.LectureYearFilter(request, params, model, model_admin)[source]

Bases: django.contrib.admin.filters.SimpleListFilter

Filter the memberships on those started or ended in a lecture year.

lookups(request, model_admin)[source]

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

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

Return the filtered queryset.

title = 'lecture year'
class activemembers.admin.MemberGroupAdmin(model, admin_site)[source]

Bases: django.contrib.admin.options.ModelAdmin

Manage the member groups.

static email(instance)[source]
fields = ('name', 'description', 'photo', 'permissions', 'since', 'until', 'contact_mailinglist', 'contact_email', 'active', 'display_members')
filter_horizontal = ('permissions',)
form

alias of activemembers.forms.MemberGroupForm

inlines = (<class 'activemembers.admin.MemberGroupMembershipInline'>,)
list_display = ('name', 'since', 'until', 'active', 'email')
list_filter = ('until', 'active')
property media
search_fields = ('name', 'description')
class activemembers.admin.MemberGroupMembershipAdmin(model, admin_site)[source]

Bases: django.contrib.admin.options.ModelAdmin

Manage the group memberships.

actions = ('export',)
changelist_view(request, extra_context=None)[source]

The ‘change list’ admin view for this model.

date_hierarchy = 'since'
export(request, queryset)[source]
form

alias of activemembers.forms.MemberGroupMembershipForm

list_display = ('member', 'group', 'since', 'until', 'chair', 'role')
list_filter = ('group', <class 'activemembers.admin.TypeFilter'>, <class 'activemembers.admin.LectureYearFilter'>, <class 'activemembers.admin.ActiveMembershipsFilter'>)
property media
search_fields = ('member__first_name', 'member__last_name', 'member__email')
class activemembers.admin.MemberGroupMembershipInline(parent_model, admin_site)[source]

Bases: django.contrib.admin.options.StackedInline

Inline for group memberships.

autocomplete_fields = ('member',)
can_delete = False
extra = 0
formset

alias of activemembers.admin.MemberGroupMembershipInlineFormSet

property media
model

alias of activemembers.models.MemberGroupMembership

ordering = ('since',)
class activemembers.admin.MemberGroupMembershipInlineFormSet(*args, **kwargs)[source]

Bases: django.forms.models.BaseInlineFormSet

Solely here for performance reasons.

Needed because the __str__() of MemberGroupMembership (which is displayed above each inline form) uses the username, name of the member and name of the group.

class activemembers.admin.MentorshipAdmin(model, admin_site)[source]

Bases: django.contrib.admin.options.ModelAdmin

Manage the mentorships.

autocomplete_fields = ('member',)
list_filter = ('year',)
property media
search_fields = ('member__first_name', 'member__last_name')
class activemembers.admin.SocietyAdmin(model, admin_site)[source]

Bases: activemembers.admin.MemberGroupAdmin

Manage the societies.

property media
class activemembers.admin.TypeFilter(request, params, model, model_admin)[source]

Bases: django.contrib.admin.filters.SimpleListFilter

Filter memberships on board-only.

lookups(request, model_admin)[source]

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

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

Return the filtered queryset.

title = 'group memberships'

activemembers.apps module

Configuration for the activemembers package.

class activemembers.apps.ActiveMembersConfig(app_name, app_module)[source]

Bases: django.apps.config.AppConfig

AppConfig for the activemembers package.

name = 'activemembers'
ready()[source]

Import the signals when the app is ready.

verbose_name = 'Active members'

activemembers.backends module

Authentication backend to check permissions.

class activemembers.backends.MemberGroupBackend[source]

Bases: object

Check permissions against MemberGroups.

authenticate(*args, **kwargs)[source]

Not implemented in this backend.

get_all_permissions(user, obj=None)[source]
get_group_permissions(user, obj=None)[source]
get_user(*args, **kwargs)[source]

Not implemented in this backend.

has_module_perms(user, app_label)[source]

Return True if user has any permissions in the given app_label.

has_perm(user, perm, obj=None)[source]

activemembers.emails module

activemembers.emails.send_gsuite_suspended_message(member)[source]

Send an email to notify a member of G Suite suspension.

Parameters

member – the member

activemembers.emails.send_gsuite_welcome_message(member, email, password)[source]

Send an email to notify a member of G Suite credentials.

Parameters
  • member – the member

  • email – G Suite primary email

  • password – randomly generated password

activemembers.forms module

The forms defined by the activemembers module.

class activemembers.forms.MemberGroupForm(*args, **kwargs)[source]

Bases: django.forms.models.ModelForm

Solely here for performance reasons.

Needed because the __str__() of Permission (which is displayed in the permissions selection box) also prints the corresponding app and content_type for each permission.

base_fields = {}
declared_fields = {}
property media

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

class activemembers.forms.MemberGroupMembershipForm(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: django.forms.models.ModelForm

Custom form for group memberships that orders the members.

class Meta[source]

Bases: object

fields = '__all__'
model

alias of activemembers.models.MemberGroupMembership

base_fields = {'chair': <django.forms.fields.BooleanField object>, 'group': <django.forms.models.ModelChoiceField object>, 'member': <django.forms.models.ModelChoiceField object>, 'role': <django.forms.fields.CharField object>, 'since': <django.forms.fields.DateField object>, 'until': <django.forms.fields.DateField object>}
declared_fields = {'member': <django.forms.models.ModelChoiceField object>}
property media

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

activemembers.gsuite module

class activemembers.gsuite.GSuiteUserService(directory_api=None)[source]

Bases: object

create_user(member: members.models.member.Member)[source]

Create a new GSuite user based on the provided data.

Parameters

member – The member that gets an account

:return returns a tuple with the password and id of the created user

delete_user(email)[source]

Delete the user from GSuite.

Parameters

email – primary email of the user

property directory_api
get_suspended_users()[source]

Get all the suspended users.

suspend_user(username)[source]

Suspend the user in GSuite.

Parameters

username – username of the user

update_user(member: members.models.member.Member, username: str)[source]

activemembers.models module

The models defined by the activemembers package.

class activemembers.models.ActiveMemberGroupManager(*args, **kwargs)[source]

Bases: django.db.models.manager.Manager

Returns active objects only sorted by the localized name.

get_queryset()[source]

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

class activemembers.models.ActiveMembershipManager(*args, **kwargs)[source]

Bases: django.db.models.manager.Manager

Custom manager that gets the currently active membergroup memberships.

get_queryset()[source]

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

class activemembers.models.Board(*args, **kwargs)[source]

Bases: activemembers.models.MemberGroup

Describes a board, which is a type of MemberGroup.

exception DoesNotExist

Bases: activemembers.models.MemberGroup.DoesNotExist

exception MultipleObjectsReturned

Bases: activemembers.models.MemberGroup.MultipleObjectsReturned

get_absolute_url()[source]
membergroup_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.

membergroup_ptr_id
save(**kwargs)[source]

Save the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

validate_unique(**kwargs)[source]

Check unique constraints on the model and raise ValidationError if any failed.

class activemembers.models.Committee(*args, **kwargs)[source]

Bases: activemembers.models.MemberGroup

Describes a committee, which is a type of MemberGroup.

exception DoesNotExist

Bases: activemembers.models.MemberGroup.DoesNotExist

exception MultipleObjectsReturned

Bases: activemembers.models.MemberGroup.MultipleObjectsReturned

active_objects = <activemembers.models.ActiveMemberGroupManager object>
get_absolute_url()[source]
membergroup_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.

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

Bases: django.db.models.base.Model

Describes a groups of members.

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.

active_objects = <activemembers.models.ActiveMemberGroupManager object>
board

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.

clean()[source]

Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.

committee

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 contact_address
contact_email

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

contact_mailinglist

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.

contact_mailinglist_id
description

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

display_members

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

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

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

get_absolute_url()[source]
id

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

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

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

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.

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>
permissions

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.

photo

Just like the FileDescriptor, but for ImageFields. The only difference is assigning the width/height to the width_field/height_field, if appropriate.

since

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

society

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.

until

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

class activemembers.models.MemberGroupMembership(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Describes a group membership.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

active_objects = <activemembers.models.ActiveMembershipManager object>
chair

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

clean()[source]

Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.

get_next_by_since(*, field=<django.db.models.fields.DateField: since>, is_next=True, **kwargs)
get_previous_by_since(*, field=<django.db.models.fields.DateField: since>, is_next=False, **kwargs)
group

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.

group_id
id

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

property initial_connected_membership

Find the oldest membership directly connected to the current one.

property is_active

Is this membership currently active.

property latest_connected_membership

Find the newest membership directly connected to the current one.

(thus the membership that started at the moment the current one ended).

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>
role

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

save(**kwargs)[source]

Save the current instance. Override this in a subclass if you want to control the saving process.

The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.

since

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

until

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

validate_unique(**kwargs)[source]

Check unique constraints on the model and raise ValidationError if any failed.

class activemembers.models.Mentorship(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Describe a mentorship during the orientation.

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

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>
year

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

class activemembers.models.Society(*args, **kwargs)[source]

Bases: activemembers.models.MemberGroup

Describes a society, which is a type of MemberGroup.

exception DoesNotExist

Bases: activemembers.models.MemberGroup.DoesNotExist

exception MultipleObjectsReturned

Bases: activemembers.models.MemberGroup.MultipleObjectsReturned

active_objects = <activemembers.models.ActiveMemberGroupManager object>
get_absolute_url()[source]
membergroup_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.

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

activemembers.services module

activemembers.services.generate_statistics()[source]

Generate statistics about number of members in each committee.

Returns

Dict with key, value being resp. name, member count of committees.

activemembers.signals module

The signals defined by the activemembers package.

activemembers.signals.pre_member_save(instance, **kwargs)[source]

activemembers.sitemaps module

class activemembers.sitemaps.BoardSitemap[source]

Bases: django.contrib.sitemaps.Sitemap

changefreq = 'yearly'
items()[source]
location(item)[source]
class activemembers.sitemaps.CommitteeSitemap[source]

Bases: django.contrib.sitemaps.Sitemap

items()[source]
location(item)[source]
class activemembers.sitemaps.SocietySitemap[source]

Bases: django.contrib.sitemaps.Sitemap

items()[source]
location(item)[source]
class activemembers.sitemaps.StaticViewSitemap[source]

Bases: django.contrib.sitemaps.Sitemap

changefreq = 'daily'
items()[source]
location(item)[source]
priority = 0.5

activemembers.urls module

The routes defined by the activemembers package.

activemembers.views module

class activemembers.views.BoardDetailView(**kwargs)[source]

Bases: activemembers.views._MemberGroupDetailView

View that renders the page of one selected board.

context_object_name = 'membergroup'
get_object(queryset=None)activemembers.models.Board[source]

Return the object the view is displaying.

Require self.queryset and a pk or slug argument in the URLconf. Subclasses can override this to return any object.

template_name = 'activemembers/board_detail.html'
class activemembers.views.BoardIndexView(**kwargs)[source]

Bases: django.views.generic.list.ListView

View that renders the board overview page.

context_object_name = 'old_boards'
current_board = None
dispatch(request, *args, **kwargs) → django.http.response.HttpResponse[source]
get_context_data(**kwargs)dict[source]

Get the context for this view.

get_queryset()django.db.models.query.QuerySet[source]

Return the list of items for this view.

The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.

template_name = 'activemembers/board_index.html'
class activemembers.views.CommitteeDetailView(**kwargs)[source]

Bases: activemembers.views._MemberGroupDetailView

View that renders the page of one selected committee.

model

alias of activemembers.models.Committee

template_name = 'activemembers/committee_detail.html'
class activemembers.views.CommitteeIndexView(**kwargs)[source]

Bases: django.views.generic.list.ListView

View that renders the committee overview page.

context_object_name = 'committees'
get_ordering()str[source]

Return the field or fields to use for ordering the queryset.

queryset = <activemembers.models.ActiveMemberGroupManager object>
template_name = 'activemembers/committee_index.html'
class activemembers.views.SocietyDetailView(**kwargs)[source]

Bases: activemembers.views._MemberGroupDetailView

View that renders the page of one selected society.

model

alias of activemembers.models.Society

template_name = 'activemembers/society_detail.html'
class activemembers.views.SocietyIndexView(**kwargs)[source]

Bases: django.views.generic.list.ListView

View that renders the societies overview page.

context_object_name = 'societies'
get_ordering()str[source]

Return the field or fields to use for ordering the queryset.

queryset = <activemembers.models.ActiveMemberGroupManager object>
template_name = 'activemembers/society_index.html'