Base

Base is the core app that serves the main pages of the visualization application. It also gathers together some miscellaneous utilities and shared classes that are used by other apps.

Views

class msgvis.apps.base.views.LoginRequiredMixin[source]

A mixin that forces a login to view the CBTemplate.

class msgvis.apps.base.views.HomeView(**kwargs)[source]

The homepage view for the website.

class msgvis.apps.base.views.ExplorerView(**kwargs)[source]

The view for the visualization tool.

class msgvis.apps.base.views.GrouperView(**kwargs)[source]

The view for the visualization tool.

Context Processors

msgvis.apps.base.context_processors.google_analytics(request)[source]

Adds a GOOGLE_ANALYTICS_ID variable to the template context.

Add this to your Django settings:

GOOGLE_ANALYTICS_ID = 'UA-XXXXXX-X'

TEMPLATE_CONTEXT_PROCESSORS += (
    'msgvis.apps.base.context_processors.google_analytics',
)

Template Tags

msgvis.apps.base.templatetags.active.active(request, pattern)[source]

Checks the current request to see if it matches a pattern. If so, it returns ‘active’.

To use, add this to your Django template:

{% load tags %}
<li class="{% active request home %}"><a href="/">Home</a></li>

Models

class msgvis.apps.base.models.MappedValuesQuerySet(*args, **kwargs)[source]

A special ValuesQuerySet that can re-map the dictionary keys while they are bing iterated over.

valuesQuerySet = queryset.values('some__ugly__field__expression')
mapped = MappedQuerySet.create_from(valuesQuerySet, {
    'some__ugly__field__expression': 'nice_expression'
})
mapped[0]
# { 'nice_expression': 5 }
classmethod create_from(values_query_set, field_map)[source]

Create a MappedValueQuerySet with a field name mapping dictionary.