Welcome | Get started | Dive | Contribute | Topics | Reference | Changes | More

lists : newsletter

The lino_xl.lib.lists plugin adds functionality for managing newsletter.

This page contains code snippets (lines starting with >>>), which are being tested during our development workflow. The following snippet initializes the demo project used throughout this page.

>>> from lino_book.projects.noi1e.startup import *
class lino_xl.lib.lists.ListType

Django model used to represent a list type. List types are the choices for the list_type field of a List.

A site manager can configure this list via Configure ‣ Contacts ‣ List Types.

>>> show_menu_path(lists.ListTypes)
Configure --> Contacts --> List Types
class lino_xl.lib.lists.List

Django model to represent a newsletter.

name
ref
list_type

The type of list. A pointer to ListType.

remark
class lino_xl.lib.lists.Member

Django model to represent a subscription to a newsletter.

user
list
remark
seqno
>>> rt.show(lists.Lists)
=========== ================================ ================== =======================
 Reference   overview                         List Type          Default for new users
----------- -------------------------------- ------------------ -----------------------
             `Announcements <…>`__            Mailing list       No
             `Weekly newsletter <…>`__        Mailing list       Yes
             `General discussion <…>`__       Discussion group   No
             `Beginners forum <…>`__          Discussion group   No
             `Developers forum <…>`__         Discussion group   No
             `PyCon 2014 <…>`__               Flags              No
             `Free Software Day 2014 <…>`__   Flags              No
             `Schools <…>`__                  Flags              No
=========== ================================ ================== =======================
>>> obj = lists.List.objects.get(pk=1)
>>> rt.show(lists.MembersByList, obj)
===== ============ ================== ======== ==========
 No.   Member       e-mail address     Remark   Workflow
----- ------------ ------------------ -------- ----------
 1     Robin Rood   demo@example.com
===== ============ ================== ======== ==========

The quick search field of a members list looks in the partner names and the membership remark.

>>> rt.show(lists.MembersByList, obj, quick_search="rob")
===== ============ ================== ======== ==========
 No.   Member       e-mail address     Remark   Workflow
----- ------------ ------------------ -------- ----------
 1     Robin Rood   demo@example.com
===== ============ ================== ======== ==========
>>> [f.name for f in lists.Member.quick_search_fields]
['user__first_name', 'user__last_name', 'user__username', 'user__email', 'remark']