intranet.apps.groups package

Submodules

intranet.apps.groups.forms module

class intranet.apps.groups.forms.GroupForm(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

class Meta[source]

Bases: object

fields = ['name', 'permissions']
model

alias of Group

declared_fields = {}

intranet.apps.groups.models module

class intranet.apps.groups.models.Group(*args, **kwargs)[source]

Bases: Group

This Group model is really just the default Django django.contrib.auth.models.Group, but with a “properties” property which returns or creates the GroupProperties field for that group. Because GroupProperties objects are only created here when they are first accessed, and not on creation or edit, you must always access them directly through the Group object, and not through GroupProperties.

This presents some complications. All model-level relationships for a group should use the Django contrib.auth.models.Group object, and not the custom one defined here. You will see this done, to avoid confusion, like:

from django.contrib.auth.models import Group as DjangoGroup

with DjangoGroup being referenced in the OneToOne or ManyToMany relationship.

e.x.:

Group.objects.get(id=9).properties.student_visible

exception DoesNotExist

Bases: DoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

objects = <intranet.apps.groups.models.GroupManager object>
property properties
class intranet.apps.groups.models.GroupManager(*args, **kwargs)[source]

Bases: GroupManager

This GroupManager model is really just the default Django django.contrib.auth.models.GroupManager, just with an extra method.

student_visible()[source]

Return a QuerySet of groups that are student-visible.

class intranet.apps.groups.models.GroupProperties(*args, **kwargs)[source]

Bases: Model

The GroupProperties model contains a OneToOneField with the intranet.apps.groups.models.Group object (really just the default django.contrib.auth.models.Group), and contains properties and other app-specific options about a group.

group

A OneToOneField with a Group object.

student_visible

Whether the group should be visible to students in group selections.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

group

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.

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.

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

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

intranet.apps.groups.tests module

class intranet.apps.groups.tests.GroupsTest(methodName='runTest')[source]

Bases: IonTestCase

test_add_group_view()[source]
test_groups_view()[source]

intranet.apps.groups.urls module

intranet.apps.groups.views module

Module contents