announcements package

Submodules

announcements.admin module

Registers admin interfaces for the announcements module.

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

Bases: django.contrib.admin.options.ModelAdmin

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

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
visible(obj)[source]

Is the object visible.

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

Bases: django.contrib.admin.options.ModelAdmin

Manage front page articles.

list_display = ('title', 'since', 'until', 'visible')

available fields in the admin overview list

property media
visible(obj)[source]

Is the object visible.

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

Bases: django.contrib.admin.options.ModelAdmin

Manage the admin pages for the slides.

list_display = ('title', 'since', 'until', 'visible')

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

property media
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]

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

content

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.

visible_objects = <announcements.models.VisibleObjectManager object>
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

content

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.

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.

visible_objects = <announcements.models.VisibleObjectManager object>
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

content

The descriptor for the file attribute on the model instance. Return a FieldFile when accessed so you can write code like:

>>> from myapp.models import MyModel
>>> instance = MyModel.objects.get(pk=1)
>>> instance.file.size

Assign a file object on assignment so you can do:

>>> with open('/path/to/hello.world') as f:
...     instance.file = File(f)
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.

visible_objects = <announcements.models.VisibleObjectManager object>
class announcements.models.VisibleObjectManager(*args, **kwargs)[source]

Bases: django.db.models.manager.Manager

Get all active members, i.e. who have a committee membership.

get_queryset()[source]

Select all visible items.

announcements.models.validate_image(value)[source]

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