#1913 (FieldDoesNotExist: Ticket has no field named '_user_cache')
by tonis · in Developers
Résumé
Caused by changing ticket.user.
Offending code is [py lino_xl.lib.tickets.models.Ticket#on_worked]:
def on_worked(self, session):
"""This is automatically called when a work session has been created
or modified.
"""
if dd.is_installed('votes'):
self.set_auto_vote(session.user, VoteStates.invited)
elif dd.is_installed('stars'):
star = get_favourite(self, user=session.user)
if star is None:
Star = rt.modules.stars.Star
star = Star(owner=self, user=session.user)
star.save()
self.touch()
Its called when the demo sessions are loaded.
Looking at [url stackoverflow.com/questions/3597762/how-does-djangos-orm-manage-to-fetch-foreign-objects-when-they-are-accessed] helps to understand why the _user_cache feild is being passed to the change_watcher. However still doesn't explaine why creating a Start pointing at the session.user is causing this.