cdh.systemmessages.models module

class cdh.systemmessages.models.SystemMessage(id, message, color, not_before, not_after)[source]

Bases: Model

Parameters
  • id (BigAutoField) – Primary key: ID

  • message (TextField) – Systemmessage.message. systemmessage.message.help_text

  • message_nl (TranslationTextField) – Systemmessage.message [nl]. systemmessage.message.help_text

  • message_en (TranslationTextField) – Systemmessage.message [en]. systemmessage.message.help_text

  • color (CharField) – Systemmessage.color. systemmessage.color.help_text

  • not_before (DateTimeField) – Systemmessage.not_before. systemmessage.not_before.help_text

  • not_after (DateTimeField) – Systemmessage.not_after. systemmessage.not_after.help_text

COLORS = (('primary', 'systemmessage.color.primary'), ('secondary', 'systemmessage.color.secondary'), ('success', 'systemmessage.color.success'), ('danger', 'systemmessage.color.danger'), ('warning', 'systemmessage.color.warning'), ('info', 'systemmessage.color.info'), ('light', 'systemmessage.color.light'), ('dark', 'systemmessage.color.dark'))
DANGER = 'danger'
DARK = 'dark'
exception DoesNotExist

Bases: ObjectDoesNotExist

INFO = 'info'
LIGHT = 'light'
exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

PRIMARY = 'primary'
SECONDARY = 'secondary'
SUCCESS = 'success'
WARNING = 'warning'
__init__(*args, **kwargs)
clean_fields(exclude=None)

Clean all fields and raise a ValidationError containing a dict of all validation errors if any occur.

color

Type: CharField

Systemmessage.color. systemmessage.color.help_text

Choices:

  • primary

  • secondary

  • success

  • danger

  • warning

  • info

  • light

  • dark

property css_class
get_color_display(*, field=<django.db.models.CharField: color>)

Shows the label of the color. See get_FOO_display() for more information.

get_deferred_fields()

Return a set containing names of deferred fields for this instance.

id

Type: BigAutoField

Primary key: ID

message

A descriptor used for the original translated field.

message_en

Type: TranslationTextField

Systemmessage.message [en]. systemmessage.message.help_text

message_nl

Type: TranslationTextField

Systemmessage.message [nl]. systemmessage.message.help_text

not_after

Type: DateTimeField

Systemmessage.not_after. systemmessage.not_after.help_text

not_before

Type: DateTimeField

Systemmessage.not_before. systemmessage.not_before.help_text

objects = <cdh.systemmessages.models.SystemMessageManager object>
refresh_from_db(using=None, fields=None)

Reload field values from the database.

By default, the reloading happens from the database this instance was loaded from, or by the read router if this instance wasn’t loaded from any database. The using parameter will override the default.

Fields can be used to specify which fields to reload. The fields should be an iterable of field attnames. If fields is None, then all non-deferred fields are reloaded.

When accessing deferred fields of an instance, the deferred loading of the field will call this method.

class cdh.systemmessages.models.SystemMessageManager(*args, **kwargs)[source]

Bases: Manager

get_current_messages()[source]

Returns a QS prefiltered to honor the not_before and not_after fields