Friday, February 5, 2016

I am writing a new import fixture for Die Eiche. Ticket #771.

They have some fields on courses.Pupil and courses.Enrolment which are definitively limited to their concrete case.

So I created the new plugin, which extends, which in turn extends

  • defines the Enrolment model with fields like course, pupil, request_date, state, …
  • does not change anything on the Enrolment model
  • extends the Enrolment model with (currently) one field.

I “activate” this plugin using the following definition on the lino_voga.projects.roger.settings.Site class:

def get_apps_modifiers(self, **kw):
    kw = super(Site, self).get_apps_modifiers(**kw)
    return kw

A surprise

But now I get the following runtime error:

RuntimeError: Conflicting 'enrolment' models in application 'courses':
<class ''> and
<class ''>.

Both model definitions correctly have defined the following Meta class:

class Meta:
    app_label = 'courses'
    abstract = dd.is_abstract_model(__name__, 'Enrolment')

Where app_label is required by recent Django versions for some reason which don’t yet fully understand.

And indeed, is_abstract_model returns False for both Enrolment models. But the one in should be abstract. That was a bug in Lino, more precisely in the logic responsible for automatically filling override_modlib_models at startup. Fixed.

Importing participants to Lino Voga

we have now an admin command eiche2lino which can run as often as we want.