announcements package

Submodules

announcements.admin module

Registers admin interfaces for the announcements module

class announcements.admin.AnnouncementAdmin(model, admin_site)[source]

Bases: utils.translation.TranslatedModelAdmin

Manage the admin pages for the announcements

content_html(obj)[source]

Get the content of the object as html

Parameters

obj – the object to render for

Returns

the stripped html

exclude = None
fields = None
list_display = ('content_html', 'since', 'until', 'visible')

show these fields in the admin overview list see :py:method:content_html for the ‘content_html’ field see :py:method:visible for the visible field

property media
search_fields = ()
visible(obj)[source]

Is the object visible

class announcements.admin.FrontpageArticleAdmin(model, admin_site)[source]

Bases: utils.translation.TranslatedModelAdmin

Manage front page articles

exclude = None
fields = None
list_display = ('title', 'since', 'until', 'visible')

available fields in the admin overview list

property media
search_fields = ()
visible(obj)[source]

Is the object visible

class announcements.admin.SlideAdmin(model, admin_site)[source]

Bases: utils.translation.TranslatedModelAdmin

Manage the admin pages for the slides

exclude = None
fields = None
list_display = ('title', 'since', 'until', 'visible')

show these fields in the admin overview list see :py:method:visible for the visible field

property media
search_fields = ()
visible(obj)[source]

Is the object visible

announcements.apps module

Configuration for the announcement package

class announcements.apps.AnnouncementsConfig(app_name, app_module)[source]

Bases: django.apps.config.AppConfig

AppConfig for the announcement package

name = 'announcements'
verbose_name = 'Site announcements'

announcements.context_processors module

These context processors can be used to expand the context provided to admin views.

announcements.context_processors.announcements(request)[source]

Gets a list of announcements.

Filters out announcements that have been closed already.

Parameters

request – the request object

Returns

a dict containing the list announcements

Return type

dict

announcements.models module

The models defined by the announcement package

class announcements.models.Announcement(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Describes an announcement

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

closeable

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

property content

Accessor that fetches the localized variant of content

content_en

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

content_nl

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

get_next_by_since(*, field=<django.db.models.fields.DateTimeField: since>, is_next=True, **kwargs)
get_previous_by_since(*, field=<django.db.models.fields.DateTimeField: since>, is_next=False, **kwargs)
icon

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.

property is_visible

Is this announcement currently visible

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

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

until

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

class announcements.models.FrontpageArticle(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Front page articles

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

property content

Accessor that fetches the localized variant of content

content_en

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

content_nl

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

get_next_by_since(*, field=<django.db.models.fields.DateTimeField: since>, is_next=True, **kwargs)
get_previous_by_since(*, field=<django.db.models.fields.DateTimeField: since>, 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.

property is_visible

Is this announcement currently visible

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

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

property title

Accessor that fetches the localized variant of title

title_en

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

title_nl

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

until

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

class announcements.models.Slide(*args, **kwargs)[source]

Bases: django.db.models.base.Model

Describes an announcement

exception DoesNotExist

Bases: django.core.exceptions.ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: django.core.exceptions.MultipleObjectsReturned

property content

Accessor that fetches the localized variant of content

content_en

Just like the FileDescriptor, but for ImageFields. The only difference is assigning the width/height to the width_field/height_field, if appropriate.

content_nl

Just like the FileDescriptor, but for ImageFields. The only difference is assigning the width/height to the width_field/height_field, if appropriate.

event_set

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.

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_visible

Is this slide currently visible

members_only

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

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

since

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.

until

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.

url_blank

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

announcements.urls module

The routes defined by this package

announcements.urls.app_name = 'announcements'

the name of this app

announcements.urls.urlpatterns = [<URLResolver <URLPattern list> (None:None) 'announcements/'>]

the actual routes

announcements.views module

Views provided by the announcements package

announcements.views.close_announcement(request)[source]

Close an announcement

Param

request

Returns

Http 204 No Content if successful