← Back to team overview

schooltool-developers team mailing list archive

Demographic field limit keys

 

Hey Guys,

I wanted to describe the recent demographics changes that I made in my
branch of schooltool, lp:~aelkner/schooltool/demo_fields.  First, the
main change is that I added a field called limit_keys to
IFieldDescription that contains a list of ids, keys if you will, that
make a given demo field apply only to the specified subset of either
basicpersons or resources.  So, for instance, if the limit_keys of a
certain person demo is ['students', 'teachers'], then the person edit
views for students and teachers would show this demo, but persons not
belonging to either group would have this demo missing from their edit
view.

At present, the person edit views that I refer to are only in my
custom schooltool.niepa package, something that we need to discuss
including in trunk, but in the case of resources, they exist in my
schooltool branch itself.  In that case the possible setting for a
given resource limit_key is 'resource', 'location', or 'equipment',
and the corresponding edit views for those resource types will reflect
the demos that apply to them.  Those views have been changed in my
branch, so you can see how I did them.

Justus,

Currently, both the person and the resource demo field edit views use
the CustomEnumFieldTextWidget for the limit_keys field, a textarea
widget, but that makes the field free-from which is not what we want.
We need the widget to be something like the default list widget,
allowing the user to create a list of select drop-downs, one for each
limit_key.  In the case of person demos, the select field would
contain 'students', 'teachers', and 'administrators'.  In the case of
resource demo fields, the list would be 'resource', 'location', and
'equipment'.  Can you point me to code that would help me create the
custom widget that allows the user to add one or more limit_keys using
a different Choice field for the person demo field limit_keys from
that or the resource demo fields?  I tried seeing what happens when I
comment out the setting of the custom widget
(fields['limit_keys'].widgetFactory = ...), but that causes it to
raise a ComponentLookupError with name of u'' and context of None.

Thanks,
Alan



Follow ups