20130312 (Tuesday, 12 March 2013)

Sequenced Stages

Jacky noticed an apparently innocent “typo” in the event calendar of the East Belgian Cyclists Federation (www.vor-cycling.be):

20.7 TRW : ETAPPE VON ANS NACH EUPEN und nicht anders rum.

As their webmaster I manage this calendar using a Lino application lino.projects.events.

That wasn’t a typo, here is how this event is being defined in the lino.modlib.events.fixtures.vor fixture:

yield event(strasse,20130720,
  "Etappenankunft Tour de la Région Wallonne (TRW)",
  "Aankomst etappe Tour de la Région Wallonne (TRW)",
  "Arrivée d'étape du Tour de la Région Wallonne (TRW)",
  cities=["Ans","Eupen"])

The explanation was that when querying a simple ManyToManyField (i.e. one without a through) clause) you cannot guarantee to have the rows rendered in the same order as they have been created. I had to define an intermediary Model Stage to solve this.

Regenerating the html for this site also revealed some problems due to the recent changes. Used this to write a test case: lino.modlib.events.tests.

Continued with the test suite

It turned out that my djangodoctest directive isn’t usable. But I found a new promising system: run_django_doctests. The first examples which pass are https://www.lino-framework.org/tutorials/human/index.html and https://www.lino-framework.org/tutorials/auto_create/index.html.