intranet.apps.events package

Submodules

intranet.apps.events.admin module

intranet.apps.events.forms module

class intranet.apps.events.forms.AdminEventForm(*args, all_groups=False, **kwargs)[source]

Bases: django.forms.models.ModelForm

class Meta[source]

Bases: object

fields = ['title', 'description', 'time', 'location', 'scheduled_activity', 'announcement', 'groups', 'show_attending', 'show_on_dashboard', 'public', 'category', 'open_to']
help_texts = {'announcement': 'OPTIONAL: Enter the ID of the announcement -- it will be displayed above the event.', 'scheduled_activity': 'OPTIONAL: Enter the ID of the scheduled activity -- it will be displayed above the event.'}
model

alias of intranet.apps.events.models.Event

widgets = {'announcement': <django.forms.widgets.NumberInput object>, 'scheduled_activity': <django.forms.widgets.NumberInput object>}
declared_fields = {}
class intranet.apps.events.forms.EventForm(*args, all_groups=False, **kwargs)[source]

Bases: django.forms.models.ModelForm

class Meta[source]

Bases: object

fields = ['title', 'description', 'time', 'location', 'groups', 'show_attending', 'show_on_dashboard', 'public', 'category', 'open_to']
model

alias of intranet.apps.events.models.Event

clean_time()[source]
declared_fields = {}

intranet.apps.events.models module

class intranet.apps.events.models.Event(*args, **kwargs)[source]

Bases: django.db.models.base.Model

An event available to the TJ community.

title

The title for the event.

Type

str

description

A description about the event.

Type

str

Links to be attached to the event. Not currently used.

Type

LinksQuerySet

added

Time created (automatically set).

Type

datetime.datetime

updated

Time last modified (automatically set).

Type

datetime.datetime

time

The date and time of the event.

Type

datetime.datetime

location

Where the event is located.

Type

str

user

The user who created the event.

Type

User

scheduled_activity

An EighthScheduledActivity that should be linked with the event.

Type

EighthScheduledActivity

announcement

An Announcement that should be linked with the event.

Type

Announcement

groups

Groups that the event is visible to.

Type

GroupQuerySet

attending

Users that are attending the event.

Type

UserQuerySet

show_attending

Whether users can mark if they are attending or not attending.

Type

bool

show_on_dashboard

Whether the event will be shown on the dashboard.

Type

bool

approved

Whether the event has been approved and will be displayed.

Type

bool

approved_by

The user who approved the event.

Type

User

rejected

Whether the event was rejected and shouldn’t be shown in the list of events that need to be approved.

Type

bool

rejected_by

The user who rejected the event.

Type

User

public

Whether the event is public and can be shown on the login page.

Type

bool

category

The category of the event, used for ordering on the login page.

Type

str

open_to

Whether this event is open to parents, students, or both, shown on the login page.

Type

bool

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

added

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

announcement

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.

announcement_id

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

approved

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

approved_by

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.

approved_by_id

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

attending

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.

category

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

created_hook(request)[source]

Run when an event is created.

property dashboard_type

Return what type of object it is

description

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

get_category_display(*, field=<django.db.models.fields.CharField: category>)
get_next_by_added(*, field=<django.db.models.fields.DateTimeField: added>, is_next=True, **kwargs)
get_next_by_time(*, field=<django.db.models.fields.DateTimeField: time>, is_next=True, **kwargs)
get_next_by_updated(*, field=<django.db.models.fields.DateTimeField: updated>, is_next=True, **kwargs)
get_open_to_display(*, field=<django.db.models.fields.CharField: open_to>)
get_previous_by_added(*, field=<django.db.models.fields.DateTimeField: added>, is_next=False, **kwargs)
get_previous_by_time(*, field=<django.db.models.fields.DateTimeField: time>, is_next=False, **kwargs)
get_previous_by_updated(*, field=<django.db.models.fields.DateTimeField: updated>, is_next=False, **kwargs)
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.

id

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

property is_this_year

Return whether the event was created after the start of the school year.

links

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.

location

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

objects = <intranet.apps.events.models.EventManager object>
open_to

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

property pinned

implement event pinning

Type

TODO

public

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

rejected

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

rejected_by

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.

rejected_by_id

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

scheduled_activity

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.

scheduled_activity_id

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

show_attending

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

show_fuzzy_date()[source]

Checks whether the event is in the next or previous 2 weeks.

Returns

Whether to display the fuzzy date.

show_on_dashboard

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

time

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

title

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

updated

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

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.

user_id

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

property user_map

Return or create an EventUserMap

class intranet.apps.events.models.EventManager[source]

Bases: django.db.models.manager.Manager

get_queryset()[source]
hidden_events(user)[source]

Get a list of events marked as hidden for a given user (usually request.user).

These are all events visible to the user – they have just decided to hide them.

Parameters

user (User) – A User to check for

Returns

Events a user has hid.

visible_to_user(user)[source]

Get a list of visible events for a given user (usually request.user).

These visible events will be those that either have no groups assigned to them (and are therefore public) or those in which the user is a member. It also includes all events created by the user.

Parameters

user (User) – A User to check for

Returns

Events that either have no groups assigned to them (and are therefore public), were created by the user, or are in a group.

class intranet.apps.events.models.EventQuerySet(model=None, query=None, using=None, hints=None)[source]

Bases: django.db.models.query.QuerySet

this_year()[source]

Get Events created during this school year.

Returns

Events created during this school year.

class intranet.apps.events.models.EventUserMap(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Represents a mapping between events and users.

These attributes would be a part of the Event model, but if they are, the last updated date is changed whenever a student sees or hides an event.

Access these through event.user_map

If you are checking to see whether a user has hidden an event, use: >>> Event.objects.hidden_events(user)

event

The one-to-one mapping between this object and the Event it is for

Type

Event

users_hidden

A many-to-many field of Users who have hidden this event

Type

UserQuerySet

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

event

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.

event_id

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

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.

class intranet.apps.events.models.EventUserMap_users_hidden(id, eventusermap, user)

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

eventusermap

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.

eventusermap_id

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

user_id

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

class intranet.apps.events.models.Event_attending(id, event, user)

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

event

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.

event_id

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

user_id

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

class intranet.apps.events.models.Event_groups(id, event, group)

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

event

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.

event_id

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

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

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>

Bases: django.db.models.base.Model

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

event

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.

event_id

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.

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.

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>

Bases: django.db.models.base.Model

A link about an item (Facebook event link, etc).

url

The URL to link to

Type

str

title

The text associated with the link

Type

str

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

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

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

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

url

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

class intranet.apps.events.models.TJStarUUIDMap(*args, **kwargs)[source]

Bases: django.db.models.base.Model

A mapping between a user and UUID for the tjSTAR widget.

user

The associated user.

uuid

The tjSTAR UUUID

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.

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

user_id

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

uuid

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

intranet.apps.events.models.clear_event_cache(sender, **kwargs)[source]

Clears any cached event data.

intranet.apps.events.notifications module

intranet.apps.events.notifications.event_approval_request(request, event)[source]

intranet.apps.events.tests module

class intranet.apps.events.tests.EventsTest(methodName='runTest')[source]

Bases: intranet.test.ion_test.IonTestCase

Tests for the events module.

create_random_event(user, approved=False, time=datetime.datetime(2020, 8, 4, 0, 25, 46, 611758, tzinfo=<UTC>), show_attending=True)[source]
test_add_event()[source]
test_delete_event()[source]
test_event_model()[source]
test_events_root_non_admin()[source]
test_join_event()[source]
test_modify_event()[source]
test_request_event()[source]
test_show_hide_event()[source]
test_show_hide_event_no_auth()[source]
test_view_roster()[source]

intranet.apps.events.urls module

intranet.apps.events.views module

Module contents