Configuring User Profiles¶
There was still a problem with yesterday’s version.
A development server on
with an AttributeError “‘UserProfile’ object has no attribute ‘office_level’”
to the first request.
To understand the problem, let’s make a tour to the internals of Lino and Django:
T:\data\luc\lino_local\presto>python manage.py shell Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> from lino.modlib.users.models import User >>> User.objects.all() [<User: Root User>, <User: Luc Saffre>] >>> u = User.objects.all() >>> print repr(u.profile) UserProfile:900(level=blank_item)
Indeed, UserProfile has no attribute office_level.
That’s because the application’s
(which redefines the UserProfiles choicelist
and adds an office_level attribute) has not yet been
Before loading a user, I must somehow call
e.g. by doing:
>>> from django.conf import settings >>> settings.LINO.startup() INFO Starting Lino... INFO Analyzing models... INFO Lino Site 'presto@armand' started. Languages: de. 117 actors. INFO Using Lino 1.4.4, Django 1.5.dev17937, python-dateutil 1.5, Cheetah 2.4.4, OdfPy ODFPY/0.9.4, docutils 0.7, suds 0.4.1, PyYaml 3.08, Appy 0.8.0 (2011/12/15 22:41), Python 2.7.1.
And now the magic has happened:
>>> u = User.objects.all() >>> print repr(u.profile) UserProfile:900(level=admin,office=admin)
Lino does this magic (calling settings.LINO.startup())
when the first web request comes in.
But more precisely,
until now this magic was done in
Now it is also done in
it’s there where the User gets loaded.
Again, it’s a pity that Django doesn’t provide a “startup” signal which is launched once when all INSTALLED_APPS have been imported. A startup signal would make these things less magic, and save a few ticks per request for not needing to check again and again whether it is the first one or not.
Moved perms and menus from lino.utils to lino.core.
This was an absolutely internal change, but it made me
discover a bug in
lino.modlib.jobsstill used the old syntax for specifying requirements
lino.modlib.cal.models.Subscription. Users now see other people’s Events only if they have subscribed to their calendar.
Calendar Panel now refreshes after editing the detail of an event
Day and Week view of calendar Panel now display hours between 8 and 18 (and no longer between 0 and 24). This is currently a hard-coded value (viewStartHour: 8, viewEndHour: 18) and cannot be configured.
Lino at Pixelbar¶
A new Lino is born! There is now a first public demo of Lino at http://lino.pixelbar-bahamut.net/
Note: the following error message was due to the fact that it used Django 1.3:
NotImplementedError at / No LayoutElement for permissions (<class ‘django.db.models.fields.related.ManyToManyField’>) in ListLayout on auth.GroupTable