intranet.apps.signage package

Subpackages

Submodules

intranet.apps.signage.admin module

class intranet.apps.signage.admin.PageAdmin(model, admin_site)[source]

Bases: ModelAdmin

actions = ['add_page_to_all_signs', 'remove_page_from_all_signs', 'lock_page_to_all_signs', 'unlock_all_signs_from_selected_pages', 'set_custom_switch_page_for_all_signs', 'set_locked_custom_switch_page_for_all_signs', 'remove_custom_switch_page_from_all_signs', 'set_custom_switch_time_for_all_signs']
add_page_to_all_signs(request, queryset)[source]
custom_page_on(obj)[source]
list_display = ('name', 'url', 'template', 'order', 'sign_list', 'lock_page_on', 'custom_page_on')
lock_page_on(obj)[source]
lock_page_to_all_signs(request, queryset)[source]
remove_custom_switch_page_from_all_signs(request, queryset)[source]
remove_page_from_all_signs(request, queryset)[source]
set_custom_switch_page_for_all_signs(request, queryset)[source]
set_custom_switch_time_for_all_signs(request, queryset)[source]
set_locked_custom_switch_page_for_all_signs(request, queryset)[source]
sign_list(obj)[source]
unlock_all_signs_from_selected_pages(request, queryset)[source]
class intranet.apps.signage.admin.SignAdmin(model, admin_site)[source]

Bases: ModelAdmin

list_display = ('name', 'display', 'lock_page', 'default_page', 'custom_switch_page', 'custom_switch_time', 'custom_switch_page_lock', 'latest_heartbeat_time', 'page_list')
page_list(obj)[source]

intranet.apps.signage.consumers module

class intranet.apps.signage.consumers.SignageConsumer(*args, **kwargs)[source]

Bases: JsonWebsocketConsumer

connect() None[source]
disconnect(code: int) None[source]
receive_json(content) None[source]

intranet.apps.signage.forms module

class intranet.apps.signage.forms.SetSignCustomSwitchTimeForm(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, field_order=None, use_required_attribute=None, renderer=None)[source]

Bases: Form

declared_fields = {'_selected_action': <django.forms.fields.CharField object>, 'action': <django.forms.fields.CharField object>, 'time': <django.forms.fields.TimeField object>}

intranet.apps.signage.models module

class intranet.apps.signage.models.Page(*args, **kwargs)[source]

Bases: Model

iframe: True if page is just an iframe url: url for iframe (if iframe is True) sandbox: whether the iframe should be sandboxed

template: the path to the template (for server side rendering) button: the name of the fontawesome icon (ex: “fa-chrome”) order: index at which button should be placed

strip_links: whether we strip the links in the iframe (to prevent navigation away)

signs: set of signs which display this Page

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

button

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

custom_page_signs

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.

default_signs

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.

deploy_to(displays=None, exclude=None, lock=False)[source]

Deploys page to listed display (specify with display). If display is None, deploy to all display. Can specify exclude for which display to exclude. This overwrites the first argument.

function

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.

iframe

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

locked_signs

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.

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.ManagerFromPageQuerySet object>
order

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

sandbox

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

signs

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.

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

template

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.signage.models.PageQuerySet(model=None, query=None, using=None, hints=None)[source]

Bases: QuerySet

order_properly() QuerySet[source]

Returns a QuerySet containing all the pages in this QuerySet, but sorted in ascending order by their order field (falling back on id when the order fields for two pages are the same).

Returns:

A QuerySet containing all the pages in this QuerySet sorted by their order and id fields in ascending order.

class intranet.apps.signage.models.Sign(*args, **kwargs)[source]

Bases: Model

name: friendly display name [required] display: unique name (should match hostname of pi/compute stick) [required]

eighth_block_increment: … landscape: if display is in landscape orientation map_location: location of display on map

lock_page: if set, the signage will only display this page default_page: if set, the signage will revert to this page after a set

amount of time

day_end_switch_page: A page to switch to near the end of the day day_end_switch_minutes: The number of minutes before the end of the day to switch

to day_end_switch_page. Can be negative to switch after the end of the day.

latest_heartbeat_time: If the sign has an open websocket connection to a

SignageConsumer, this is the time at which the last message was received from it. If the sign does not have such a connection open, this is None (even if the sign previously had an open connection).

pages: a list of pages

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

custom_switch_page

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.

custom_switch_page_id
custom_switch_page_lock

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

custom_switch_time

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

day_end_switch_minutes

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

day_end_switch_page

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.

day_end_switch_page_id
default_page

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.

default_page_id
display

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

eighth_block_increment

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.

img_path

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

property is_offline: bool
landscape

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

latest_heartbeat_time

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

lock_page

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.

lock_page_id
map_location

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.ManagerFromSignQuerySet object>
pages

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.signage.models.SignQuerySet(model=None, query=None, using=None, hints=None)[source]

Bases: QuerySet

filter_offline() QuerySet[source]
filter_online() QuerySet[source]
class intranet.apps.signage.models.Sign_pages(id, sign, page)

Bases: Model

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: 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>
page

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.

page_id
sign

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.

sign_id

intranet.apps.signage.pages module

intranet.apps.signage.pages.announcements(page, sign, request)[source]
intranet.apps.signage.pages.bus(page, sign, request)[source]
intranet.apps.signage.pages.hello_world(page, sign, request)[source]

intranet.apps.signage.tests module

class intranet.apps.signage.tests.SignageTestCase(methodName='runTest')[source]

Bases: IonTestCase

test_check_internal_ip()[source]
test_eighth()[source]
test_prometheus_metrics()[source]
test_signage_display()[source]

intranet.apps.signage.urls module

intranet.apps.signage.views module

intranet.apps.signage.views.check_internal_ip(request) Optional[HttpResponse][source]

A method to determine if a request is allowed to load a signage page.

Denies access by returning None unless the user is authenticated and not restricted, or the request IP address is in settings.INTERNAL_IPS.

Returns:

a 403 if the request is unauthorized or None if the request is authorized

intranet.apps.signage.views.eighth(request)[source]

Displays the eighth period signage page. This cannot be a regular signage page because it needs to reload in order to switch blocks or update information..

intranet.apps.signage.views.prometheus_metrics(request)[source]

Prometheus metrics for signage displays. Currently just whether or not they are online.

intranet.apps.signage.views.signage_display(request, display_id: str) HttpResponse[source]

Module contents