loefsys.groups.models.group module

Module defining the generic group model.

class loefsys.groups.models.group.GroupManager(*args, **kwargs)

Bases: Manager, Generic

Custom manager for group models.

The manager is used by models inheriting the LoefbijterGroup model.

use_in_migrations = True

If set to True the manager will be serialized into migrations and will thus be available in e.g. RunPython operations.

get_by_natural_key(name)

Get an instance by its natural key.

class loefsys.groups.models.group.LoefbijterGroup(*args, **kwargs)

Bases: Model Extensions

Describes a group of members.

Groups are a generic way of categorizing users to apply permissions, or some other label, to those users. A user can belong to any number of groups.

This model represents a group within Loefbijter. Subclasses exist for specific groups, such as boards or committees, but the generic model is also available. This model mirrors the behaviour of the internal Django Groups model as it provides an easy way of managing permissions.

name

The name of the group.

Type:

str

description

A description of the group.

Type:

str

permissions

The permissions for this group.

Type:

QuerySet or Permission

date_foundation

The date that the group was founded on.

Type:

date

date_discontinuation

The date that the group ceased to exist. Cannot be before date_foundation.

Type:

date, None

display_members

A flag that determines whether the members of the group are publicly visible.

Type:

bool

Properties
----------
active

A property that returns whether the group is currently active.

It is calculated by whether date_discontinuation exists and whether the date has passed.

name

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.

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.

date_foundation

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

date_discontinuation

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

property active

Return whether the group is currently active.

display_members

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

objects = <loefsys.groups.models.group.GroupManager object>
natural_key()

Return the natural key for a group.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

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.

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.

created

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

fraternity

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(*, field=<django_extensions.db.fields.CreationDateTimeField: created>, is_next=True, **kwargs)
get_next_by_date_foundation(*, field=<django.db.models.fields.DateField: date_foundation>, is_next=True, **kwargs)
get_next_by_modified(*, field=<django_extensions.db.fields.ModificationDateTimeField: modified>, is_next=True, **kwargs)
get_previous_by_created(*, field=<django_extensions.db.fields.CreationDateTimeField: created>, is_next=False, **kwargs)
get_previous_by_date_foundation(*, field=<django.db.models.fields.DateField: date_foundation>, is_next=False, **kwargs)
get_previous_by_modified(*, field=<django_extensions.db.fields.ModificationDateTimeField: modified>, 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.

modified

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

organizing_group

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.

taskforce

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.

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

yearclub

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.