Welcome | Get started | Dive into Lino | Contribute | Topics | Reference | More

Generic Foreign Keys

This document tests some functionalities implemented by lino.modlib.gfks.

This page is a tested document and the following instructions are used for initialization:

>>> 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