Welcome | Get started | Dive | Contribute | Topics | Reference | Changes | More
news : news writer¶
The lino_xl.lib.news plugin adds functionality for managing
news writers.
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 *
Introduction¶
- news writer¶
A configuration entry that describes a report to be sent via email at regular intervals to a given audience.
Class reference¶
- class lino_xl.lib.news.Writer¶
Django model to represent a news writer.
- user¶
The owner of this news writer.
- audience¶
A pointer to the list of recipients of news written by this writer. In a default config this is an instance of
lino_xl.lib.lists.List. But this can be configurer in ofaudience_model.
- email_template¶
The name of the template to use when this writer creates an email.
- name¶
- ref¶
- lino_xl.lib.news.audience_model¶
The database model to use as
Writer.audienceof a news writer.
>>> rt.show(news.Writers)
===== ========= =================== ==================
No. Name News list Email template
----- --------- ------------------- ------------------
1 Weekly Announcements weekly.eml.html
2 Monthly Weekly newsletter monthly.eml.html
===== ========= =================== ==================
>>> obj = news.Writer.objects.get(pk=1)
>>> ar = rt.login('robin')
>>> ar.today()
datetime.date(2015, 5, 22)
>>> mail = obj.make_email(ar)
>>> show_mail(mail)
Subject: [noi1e] Week 20 activity report
Sender: root@localhost
To: ['Robin Rood <demo@example.com>']
CC: []
BCC: []
This is a weekly report about the activity on [noi1e](http://127.0.0.1:8000)
site.
\----------------- Working contracts \----------------- +--------------------+------------+-----------+------------+-----------+------------+ | Worker | Hours/week | Hours | Hours | Comments | Comments | | | | last week | last month | last week | last month | +====================+============+===========+============+===========+============+ | Mathieu | 20:00 | 21:27 | 95:06 | 0 | 12 | +--------------------+------------+-----------+------------+-----------+------------+ | Luc | 30:00 | 23:07 | 96:55 | 0 | 12 | +--------------------+------------+-----------+------------+-----------+------------+ | Jean | 40:00 | 21:23 | 96:51 | 0 | 12 | +--------------------+------------+-----------+------------+-----------+------------+ | **Total (3 rows)** | **90:00** | **65:57** | **288:52** | **0** | **36** | +--------------------+------------+-----------+------------+-----------+------------+
Thank you for working with us.
Attachments:
None text/html