org.views.newsletter ==================== .. py:module:: org.views.newsletter .. autoapi-nested-parse:: The newsletter view. Functions --------- .. autoapisummary:: org.views.newsletter.get_newsletter_form org.views.newsletter.newsletter_news_by_access org.views.newsletter.visible_news_by_newsletter org.views.newsletter.occurrences_by_newsletter org.views.newsletter.publications_by_newsletter org.views.newsletter.handle_newsletters org.views.newsletter.handle_update_newsletters_subscription org.views.newsletter.view_newsletter org.views.newsletter.view_subscribers org.views.newsletter.handle_new_newsletter org.views.newsletter.edit_newsletter org.views.newsletter.delete_newsletter org.views.newsletter.send_newsletter org.views.newsletter.handle_send_newsletter org.views.newsletter.handle_test_newsletter org.views.newsletter.handle_preview_newsletter org.views.newsletter.export_newsletter_recipients org.views.newsletter.import_newsletter_recipients Module Contents --------------- .. py:function:: get_newsletter_form(model: onegov.newsletter.Newsletter, request: onegov.org.request.OrgRequest) -> type[onegov.org.forms.NewsletterForm] .. py:function:: newsletter_news_by_access(newsletter: onegov.newsletter.Newsletter, request: onegov.org.request.OrgRequest, access: str = 'public') -> list[onegov.org.models.News] | None Retrieves a list of news items associated with a specific newsletter based on the given access level or higher. This function is used for the newsletter preview as well as for sending newsletters. The function filters the news items based on their access level ('public', 'secret', 'private') and whether they are published. It then orders the news items in descending order by their creation date. Returns: - list[News] | None: A list of news items that match the provided access level. If no news items are found, None is returned. Raises: - ValueError: If an invalid access level is provided. .. py:function:: visible_news_by_newsletter(newsletter: onegov.newsletter.Newsletter, request: onegov.org.request.OrgRequest) -> list[onegov.org.models.News] | None Retrieves a list of news items associated with a specific newsletter visible to the current user. .. py:function:: occurrences_by_newsletter(newsletter: onegov.newsletter.Newsletter, request: onegov.org.request.OrgRequest) -> sqlalchemy.orm.Query[onegov.event.Occurrence] | None .. py:function:: publications_by_newsletter(newsletter: onegov.newsletter.Newsletter, request: onegov.org.request.OrgRequest) -> sqlalchemy.orm.Query[onegov.file.File] | None .. py:function:: handle_newsletters(self: onegov.newsletter.NewsletterCollection, request: onegov.org.request.OrgRequest, form: onegov.org.forms.SignupForm, layout: onegov.org.layout.NewsletterLayout | None = None, mail_layout: onegov.org.layout.DefaultMailLayout | None = None, title: str = '', update: bool = False) -> onegov.core.types.RenderData | webob.Response .. py:function:: handle_update_newsletters_subscription(self: onegov.newsletter.NewsletterCollection, request: onegov.org.request.OrgRequest, form: onegov.org.forms.SignupForm, layout: onegov.org.layout.NewsletterLayout | None = None, mail_layout: onegov.org.layout.DefaultMailLayout | None = None) -> onegov.core.types.RenderData | webob.Response .. py:function:: view_newsletter(self: onegov.newsletter.Newsletter, request: onegov.org.request.OrgRequest, layout: onegov.org.layout.NewsletterLayout | None = None) -> onegov.core.types.RenderData .. py:function:: view_subscribers(self: onegov.newsletter.RecipientCollection, request: onegov.org.request.OrgRequest, layout: onegov.org.layout.RecipientLayout | None = None) -> onegov.core.types.RenderData .. py:function:: handle_new_newsletter(self: onegov.newsletter.NewsletterCollection, request: onegov.org.request.OrgRequest, form: onegov.org.forms.NewsletterForm, layout: onegov.org.layout.NewsletterLayout | None = None) -> onegov.core.types.RenderData | webob.Response .. py:function:: edit_newsletter(self: onegov.newsletter.Newsletter, request: onegov.org.request.OrgRequest, form: onegov.org.forms.NewsletterForm, layout: onegov.org.layout.NewsletterLayout | None = None) -> onegov.core.types.RenderData | webob.Response .. py:function:: delete_newsletter(self: onegov.newsletter.Newsletter, request: onegov.org.request.OrgRequest) -> None .. py:function:: send_newsletter(request: onegov.org.request.OrgRequest, newsletter: onegov.newsletter.Newsletter, recipients: collections.abc.Iterable[onegov.newsletter.Recipient], is_test: bool = False, layout: onegov.org.layout.DefaultMailLayout | None = None) -> int .. py:function:: handle_send_newsletter(self: onegov.newsletter.Newsletter, request: onegov.org.request.OrgRequest, form: onegov.org.forms.NewsletterSendForm, layout: onegov.org.layout.NewsletterLayout | None = None) -> onegov.core.types.RenderData | webob.Response .. py:function:: handle_test_newsletter(self: onegov.newsletter.Newsletter, request: onegov.org.request.OrgRequest, form: onegov.org.forms.NewsletterTestForm, layout: onegov.org.layout.NewsletterLayout | None = None) -> onegov.core.types.RenderData | webob.Response .. py:function:: handle_preview_newsletter(self: onegov.newsletter.Newsletter, request: onegov.org.request.OrgRequest, layout: onegov.org.layout.DefaultMailLayout | None = None) -> onegov.core.types.RenderData .. py:function:: export_newsletter_recipients(self: onegov.newsletter.RecipientCollection, request: onegov.org.request.OrgRequest, form: onegov.org.forms.ExportForm, layout: onegov.org.layout.RecipientLayout | None = None) -> onegov.core.types.RenderData | webob.Response .. py:function:: import_newsletter_recipients(self: onegov.newsletter.RecipientCollection, request: onegov.org.request.OrgRequest, form: onegov.org.forms.newsletter.NewsletterSubscriberImportExportForm, layout: onegov.org.layout.RecipientLayout | None = None) -> onegov.core.types.RenderData | webob.Response