Welcome | Get started | Dive | Contribute | Topics | Reference | Changes | More
noi2 : Noi with publisher and without accounting¶
>>> from lino_book.projects.noi2.startup import *
Available user types¶
The noi2 demo site has the following users:
>>> rt.show(rt.models.users.UsersOverview)
...
========== ===================== ==========
Username User type Language
---------- --------------------- ----------
andy 100 (Customer) en
bert 100 (Customer) en
chloe 100 (Customer) en
jean 400 (Developer) en
luc 400 (Developer) en
marc 100 (Customer) en
mathieu 200 (Contributor) en
robin 900 (Administrator) en
roby 900 (Administrator) bn
rolf 900 (Administrator) de
========== ===================== ==========
Installed plugins¶
>>> for p in settings.SITE.installed_plugins:
... print("{}: {}".format(p.app_label, p))
lino: lino
about: lino.modlib.about
jinja: lino.modlib.jinja
react: lino_react.react
printing: lino.modlib.printing
system: lino.modlib.system
channels: channels
daphne: daphne
linod: lino.modlib.linod
bootstrap5: lino.modlib.bootstrap5
publisher: lino.modlib.publisher
contenttypes: django.contrib.contenttypes
gfks: lino.modlib.gfks
help: lino.modlib.help
office: lino.modlib.office
xl: lino_xl.lib.xl
countries: lino_xl.lib.countries
contacts: lino_noi.lib.contacts
social_django: social_django
users: lino_noi.lib.users
topics: lino_xl.lib.topics
excerpts: lino_xl.lib.excerpts
memo: lino.modlib.memo
comments: lino.modlib.comments
noi: lino_noi.lib.noi
tickets: lino_noi.lib.tickets
nicknames: lino_xl.lib.nicknames
summaries: lino.modlib.summaries
checkdata: lino.modlib.checkdata
working: lino_xl.lib.working
lists: lino_xl.lib.lists
changes: lino.modlib.changes
notify: lino.modlib.notify
uploads: lino.modlib.uploads
export_excel: lino.modlib.export_excel
tinymce: lino.modlib.tinymce
smtpd: lino.modlib.smtpd
weasyprint: lino.modlib.weasyprint
appypod: lino_xl.lib.appypod
dashboard: lino.modlib.dashboard
inbox: lino_xl.lib.inbox
userstats: lino_xl.lib.userstats
groups: lino_noi.lib.groups
albums: lino_xl.lib.albums
sources: lino_xl.lib.sources
blogs: lino_xl.lib.blogs
polls: lino_xl.lib.polls
cal: lino_noi.lib.cal
agenda: lino_xl.lib.agenda
calview: lino_xl.lib.calview
matrix: lino_xl.lib.matrix
addresses: lino_xl.lib.addresses
phones: lino_xl.lib.phones
google: lino_xl.lib.google
languages: lino.modlib.languages
songs: lino_xl.lib.songs
staticfiles: django.contrib.staticfiles
sessions: django.contrib.sessions
Language selector¶
>>> lang = settings.SITE.languages[1]
>>> lang
LanguageInfo(django_code='bn', name='bn', index=1, suffix='_bn')
>>> ar = rt.login(renderer=dd.plugins.publisher.renderer)
>>> publisher.Page.objects.get(pk=1)
Page #1 ('Home')
>>> ar = publisher.Pages.create_request(parent=ar, selected_pks=[1])
>>> print(ar.get_request_url())
/p/home
>>> print(ar.get_request_url(ul="bn"))
/p/home?ul=bn
Printable documents¶
We take the first meeting that has some agenda items, clear the cache, ask Lino to print it and check whether we get the expected response.
>>> ses = rt.login("robin")
>>> translation.activate('en')
>>> obj = agenda.Item.objects.first().meeting
>>> obj
Event #249 ('FlyingCon (12.05.2024 10:00)')
>>> obj.clear_cache()
>>> rv = ses.run(obj.do_print)
weasy2pdf render ['cal/Event/default.weasy.html'] ->
.../media/cache/weasy2pdf/cal.Event-249.pdf ('en', {})
>>> print(rv['success'])
True
>>> print(rv['open_url'])
/media/cache/weasy2pdf/cal.Event-249.pdf
>>> print(rv['message'])
Your printable document (<a href="...">cal.Event-249.pdf</a>) should now open in a new browser window. If it doesn't, please ask your system administrator.
Clear the print cache to tidy up:
>>> obj.clear_cache()
Embedded images¶
The demo2 fixture of the blogs plugin
(xl/lino_xl/lib/blogs/fixtures/demo2.py) simulates the situation where
the end user pastes an image into the text editor of a comment. This is
different from uploading the image as a file and then inserting a reference to
it into the comment.
>>> obj = comments.Comment.objects.filter(body__contains="Here is an image:").first()
>>> print(obj.body)
<p>Here is an image:</p>
<p><img class="bar" data-upload_id="25" src="/media/thumbs/uploads/2024/05/....png"/></p>
>>> rt.show(memo.MentionsByOwner, obj, display_mode="grid",
... column_names="owner_type owner_id target_type target_id")
...
====================== ======================== =============== =================
Controlled by (type) Controlled by (object) Target (type) Target (object)
---------------------- ------------------------ --------------- -----------------
Comment 1208 Upload file 25
====================== ======================== =============== =================
Don’t read this¶
Pages: (skipped temporarily there will be more changes for #6253 (Multiple menu trees in publisher))
>>> rt.show('publisher.Pages', display_mode="grid",
... column_names="ref parent title language")
...
=========== ============ =============================== ==========
Reference Parent Title Language
----------- ------------ ------------------------------- ----------
index Home en
index হোম bn
index Startseite de
Terms and conditions en
Terms and conditions bn
Allgemeine Geschäftsbediungen de
Privacy policy en
Privacy policy bn
Datenschutz de
Cookie settings en
Cookie settings bn
Cookie settings de
Copyright en
Copyright bn
Autorenrecht de
About us en
About us bn
Über uns de
Home Blog en
হোম Blog bn
Startseite Blog de
Home Calendar en
হোম Calendar bn
Startseite Kalender de
Home Mission en
Home Maxim en
Home Propaganda en
Home About us en
About us Team en
About us History en
About us Contact en
About us Terms & conditions en
হোম Mission bn
হোম Maxim bn
হোম Propaganda bn
হোম About us bn
About us Team bn
About us History bn
About us Contact bn
About us Terms & conditions bn
Startseite Mission de
Startseite Maxim de
Startseite Propaganda de
Startseite Über uns de
Über uns Team de
Über uns History de
Über uns Kontakt de
Über uns Nutzungsbestimmungen de
SynodalCon
Cascaded Continuous Voting
Liquid democracy
Digital vs analog
Software should be free
Synodality
=========== ============ =============================== ==========
Ensure database state:
>>> for obj in linod.SystemTask.objects.all():
... obj.last_start_time = None
... obj.requested_at = None
... obj.disabled = False
... obj.save()
>>> from logging import getLevelName
>>> from asgiref.sync import async_to_sync
>>> bt = linod.SystemTask.objects.get(procedure=linod.Procedures.update_publisher_pages)
>>> bt.status
'Scheduled to run asap'
>>> ar = rt.login("robin")
>>> print(getLevelName(ar.logger.level))
INFO
>>> ar.logger.setLevel("DEBUG")
>>> print(getLevelName(ar.logger.level))
DEBUG
>>> ar.logger.handlers
[<StreamHandler (INFO)>, <AdminEmailHandler (ERROR)>]
>>> [getLevelName(h.level) for h in ar.logger.handlers]
['INFO', 'ERROR']
>>> ar.logger.handlers[0].setLevel("DEBUG")
>>> async_to_sync(bt.start_task)(ar)
Start System task #1 (update_publisher_pages) with logging level INFO
Create special pages...
Update publisher pages...
119 pages have been updated.
Successfully terminated System task #1 (update_publisher_pages)
>>> bt.disabled
False
>>> bt.status
'Scheduled to run at ... (... from now)'
>>> bt = linod.SystemTask.objects.get(procedure=linod.Procedures.delete_older_changes)
>>> bt.status
'Scheduled to run asap'
‘Scheduled to run asap’ >>> async_to_sync(bt.start_task)(ar) Start System task #3 (delete_older_changes) with logging level INFO Successfully terminated System task #3 (delete_older_changes) >>> bt.disabled False >>> bt.status #doctest: +ELLIPSIS ‘Scheduled to run at … (… from now)’
>>> bt.run_now.run_from_ui(ar)
>>> bt.message
'Robin Rood requested to run this task at ....'
>>> bt.status
'Requested to run asap (since ... (...))'
Restore database state:
>>> for obj in linod.SystemTask.objects.all():
... obj.last_start_time = None
... obj.requested_at = None
... obj.disabled = False
... obj.save()
>>> dbhash.check_virgin()