newsletter.models
Attributes
Classes
Represents a newsletter before and after it is sent. |
|
Represents a single recipient. |
|
Adds subscription management to a recipient. |
Module Contents
- class newsletter.models.Newsletter[source]
Bases:
onegov.core.orm.Base
,onegov.core.orm.mixins.ContentMixin
,onegov.core.orm.mixins.TimestampMixin
,onegov.search.SearchableContent
Represents a newsletter before and after it is sent.
A newsletter basically consists of a title/subject, a content and a number of recipients. We assume that all newsletters are sent in HTML using onegov.core, which automatically creates a text representation.
- es_id = 'name'[source]
The name of the id attribute (not the actual value!).
If you use this on an ORM model, be sure to use a primary key, all other properties are not available during deletion.
- es_properties[source]
Returns the type mapping of this model. Each property in the mapping will be read from the model instance.
The returned object needs to be a dict or an object that provides a
to_dict
method.Internally, onegov.search stores differing languages in different indices. It does this automatically through langauge detection, or by manually specifying a language.
Note that objects with multiple languages are not supported (each object is supposed to have exactly one language).
Onegov.search will automatically insert the right analyzer for types like these.
There’s currently only limited support for properties here, namely objects and nested mappings do not work! This is going to be added in the future though.
- class newsletter.models.Recipient[source]
Bases:
onegov.core.orm.Base
,onegov.core.orm.mixins.TimestampMixin
,onegov.core.orm.mixins.ContentMixin
Represents a single recipient.
Recipients may be grouped by any kind of string. Only inside their groups are recipient addresses unique. However, groups are an optional feature and they are not deeply integrated. If you don’t care for group, never use them and the list becomes like a simple list of addresses with no duplicate addresses present.
- newsletters: relationship[list[Newsletter]][source]
- property subscription: Subscription[source]