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(needed by lino_react.react)
react: lino_react.react(needs ['lino.modlib.jinja'])
printing: lino.modlib.printing(needed by lino.modlib.system)
system: lino.modlib.system(needed by lino.modlib.publisher, needs ['lino.modlib.printing'])
channels: channels(needed by lino.modlib.linod)
daphne: daphne(needed by lino.modlib.linod)
linod: lino.modlib.linod(needed by lino.modlib.publisher)
bootstrap5: lino.modlib.bootstrap5(needed by lino.modlib.publisher, needs ['lino.modlib.jinja'])
publisher: lino.modlib.publisher(needs ['lino.modlib.system', 'lino.modlib.linod', 'lino.modlib.jinja', 'lino.modlib.bootstrap5'])
contenttypes: django.contrib.contenttypes(needed by lino.modlib.gfks)
gfks: lino.modlib.gfks(needs ['lino.modlib.system', 'django.contrib.contenttypes'])
help: lino.modlib.help(needs ['lino.modlib.system'])
office: lino.modlib.office(needed by lino_xl.lib.countries)
xl: lino_xl.lib.xl(needed by lino_xl.lib.countries)
countries: lino_xl.lib.countries(needed by lino_noi.lib.contacts, needs ['lino.modlib.office', 'lino_xl.lib.xl'])
contacts: lino_noi.lib.contacts(needs ['lino_xl.lib.countries', 'lino.modlib.system'])
social_django: social_django(needed by lino_noi.lib.users)
users: lino_noi.lib.users(needs ['lino.modlib.system', 'social_django'])
topics: lino_xl.lib.topics(needs ['lino_xl.lib.xl', 'lino.modlib.gfks'])
excerpts: lino_xl.lib.excerpts(needed by lino_noi.lib.tickets, needs ['lino.modlib.gfks', 'lino.modlib.printing', 'lino.modlib.office', 'lino_xl.lib.xl'])
memo: lino.modlib.memo(needed by lino.modlib.comments, needs ['lino.modlib.office', 'lino.modlib.gfks'])
comments: lino.modlib.comments(needed by lino_noi.lib.tickets, needs ['lino.modlib.memo'])
noi: lino_noi.lib.noi(needed by lino_noi.lib.tickets)
tickets: lino_noi.lib.tickets(needs ['lino_xl.lib.excerpts', 'lino.modlib.comments', 'lino_noi.lib.noi'])
nicknames: lino_xl.lib.nicknames
summaries: lino.modlib.summaries(needed by lino_xl.lib.working)
checkdata: lino.modlib.checkdata(needed by lino_xl.lib.working, needs ['lino.modlib.users', 'lino.modlib.gfks', 'lino.modlib.office', 'lino.modlib.linod'])
working: lino_xl.lib.working(needs ['lino.modlib.summaries', 'lino.modlib.checkdata'])
lists: lino_xl.lib.lists
changes: lino.modlib.changes(needs ['lino.modlib.users', 'lino.modlib.gfks'])
notify: lino.modlib.notify(needs ['lino.modlib.users', 'lino.modlib.memo', 'lino.modlib.linod'])
uploads: lino.modlib.uploads
export_excel: lino.modlib.export_excel
tinymce: lino.modlib.tinymce(needs ['lino.modlib.office'])
smtpd: lino.modlib.smtpd
weasyprint: lino.modlib.weasyprint(needs ['lino.modlib.jinja'])
appypod: lino_xl.lib.appypod
dashboard: lino.modlib.dashboard(needs ['lino.modlib.users'])
inbox: lino_xl.lib.inbox(needs ['lino.modlib.comments'])
userstats: lino_xl.lib.userstats(needs ['lino.modlib.users'])
groups: lino_noi.lib.groups
albums: lino_xl.lib.albums(needed by lino_xl.lib.blogs, needs ['lino.modlib.uploads'])
sources: lino_xl.lib.sources(needed by lino_xl.lib.blogs)
blogs: lino_xl.lib.blogs(needs ['lino.modlib.publisher', 'lino_xl.lib.topics', 'lino_xl.lib.albums', 'lino_xl.lib.sources'])
polls: lino_xl.lib.polls(needs ['lino_xl.lib.xl'])
cal: lino_noi.lib.cal(needs ['lino.modlib.gfks', 'lino.modlib.printing', 'lino_xl.lib.xl', 'lino_noi.lib.noi'])
agenda: lino_xl.lib.agenda(needs ['lino_xl.lib.checkdata'])
calview: lino_xl.lib.calview
matrix: lino_xl.lib.matrix
addresses: lino_xl.lib.addresses(needed by lino_xl.lib.google, needs ['lino.modlib.checkdata'])
phones: lino_xl.lib.phones(needed by lino_xl.lib.google)
google: lino_xl.lib.google(needs ['lino.modlib.users', 'lino_xl.lib.addresses', 'lino_xl.lib.phones'])
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(ul="bn"))
/?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()
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
Update publisher pages...
144 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 #4 (delete_older_changes) with logging level INFO Successfully terminated System task #4 (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()