Welcome | Get started | Dive | Contribute | Topics | Reference | Changes | More
Generic Foreign Keys¶
This document tests some functionalities implemented by lino.modlib.gfks
.
Side note: Code snippets (lines starting with >>>
) in this document get
tested as part of our development workflow. The following
initialization snippet tells you which demo project is being used in
this document.
>>> from lino import startup
>>> startup('lino_book.projects.min2.settings.demo')
>>> from lino.api.doctest import *
The detail view of lino.modlib.gfks.ContentTypes
has the
following fields:
>>> ct = contenttypes.ContentType.objects.get_for_model(countries.Country).id
>>> d = get_json_dict('robin', 'gfks/ContentTypes/{}'.format(ct))
>>> rmu(sorted(d.keys()))
['data', 'disable_delete', 'id', 'navinfo', 'title']
>>> rmu(sorted(d['data'].keys()))
['app_label', 'base_classes', 'disable_editing', 'disabled_fields', 'id', 'model']
>>> for k in sorted(d['data'].keys()):
... print("{} : {}".format(k, rmu(d['data'][k])))
app_label : countries
base_classes : <p />
disable_editing : False
disabled_fields : {'id': True}
id : ...
model : country