oTree Forum >

Inheritance for otree models not working for abstract base class

#1 by Scott

Hi there,

I have an app that needs repeating in the middle and the end of the experiment, so was trying to create abstract base classes for Player, Group and Subsession, however I get an error. (I'm using otree 5.8.0)
__________________
Models.py:

class SharedBasePlayer(BasePlayer):
    __abstract__ = True
    choice = models.StringField()

class Player(SharedBasePlayer):
    pass
____________________
Error message:
...
  File "/home/s/.local/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 182, in raise_
    raise exception
AttributeError: Neither 'OTreeColumn' object nor 'Comparator' object has an attribute 'form_props'


Thanks in advance
Scott

#2 by BonnEconLab

Since you mentioned that the objective is to create “an app that needs repeating in the middle and the end of the experiment,” this may be of help: https://groups.google.com/g/otree/c/2Z3d_SStb5o/m/kEjHjBL_BAAJ.

Write a reply

Set forum username