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

albums : Media albums

The lino_xl.lib.albums plugin adds functionality for managing albums of uploaded files (photos, videos, sound or other)

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.noi2.startup import *

Albums

>>> rt.show(albums.Albums)
====================== ============ ====== ====
 Title                  Author       Team   ID
---------------------- ------------ ------ ----
 Thriller book covers   Robin Rood          1
 Photos                 Robin Rood          2
====================== ============ ====== ====
>>> rt.show(albums.AlbumItems)
==== ===== ================================ ==================================== ======= ==============
 ID   No.   Album                            Upload file                          Title   Image format
---- ----- -------------------------------- ------------------------------------ ------- --------------
 1    1     Album 1 (Thriller book covers)   Murder on the orient express cover
 2    2     Album 1 (Thriller book covers)   Storm island cover
 3    3     Album 1 (Thriller book covers)   And then there were none
 4    4     Album 1 (Thriller book covers)   First there were ten
 5    1     Album 2 (Photos)                 2021 IMG 20210330 151858.jpg
 6    2     Album 2 (Photos)                 2021 IMG 20210330 151914.jpg
 7    3     Album 2 (Photos)                 2021 IMG 20210509 124718.jpg
 8    4     Album 2 (Photos)                 2021 IMG 20210623 230806.jpg
 9    5     Album 2 (Photos)                 2021 IMG 20210811 152759.jpg
 10   6     Album 2 (Photos)                 2022 IMG 20220602 174509.jpg
 11   7     Album 2 (Photos)                 2022 IMG 20220708 133128.jpg
 12   8     Album 2 (Photos)                 2022 IMG 20220805 145344.jpg
 13   9     Album 2 (Photos)                 2022 IMG 20220827 064158.jpg
 14   10    Album 2 (Photos)                 2022 IMG 20220904 140701.jpg
==== ===== ================================ ==================================== ======= ==============
>>> obj = albums.Album.objects.get(pk=1)
>>> rt.show(albums.ItemsByAlbum, obj)
===== ==================================== ========================================================================== ======= ==============
 No.   Upload file                          Thumbnail                                                                  Title   Image format
----- ------------------------------------ -------------------------------------------------------------------------- ------- --------------
 1     Murder on the orient express cover   `[img /media/thumbs/uploads/2024/05/MurderontheOrientExpress.jpg] <…>`__
 2     Storm island cover                   `[img /media/thumbs/uploads/2024/05/StormIsland.jpg] <…>`__
 3     And then there were none             `[img /media/thumbs/uploads/2024/05/AndThenThereWereNone.jpg] <…>`__
 4     First there were ten                 `[img /media/thumbs/uploads/2024/05/FirstThereWereTen.jpg] <…>`__
===== ==================================== ========================================================================== ======= ==============

Database models

class lino_xl.lib.albums.Album

Represents an album.

class lino_xl.lib.albums.AlbumItem

Represents an individual item of a given album.

album

Pointer to the album.

upload

Pointer to the upload.

seqno
title

The text to add as title attribute of the img tag.

image_format