oTree Forum >

Is it possible to have multiple custom exports for an app?

#1 by clintmckenna

Whithin an app, I have a couple ExtraModels. It would be convenient to have one custom export for each, since the data are structured quite differently. Thanks!

#2 by Chris_oTree

It's not directly supported but one workaround is to toggle it based on a Heroku config var, e.g.:

def custom_export_model1(players):
    ...

def custom_export_model2(players):
    ...

def custom_export(players):
    import os
    export_mode = os.environ.get('CUSTOM_EXPORT_MODE')
    if export_mode == '1':
        return custom_export_model1(players)
    elif export_mode == '2':
        return custom_export_model2(players)

Then change those through the otree admin.

#3 by clintmckenna

I'll try it, thanks!

Write a reply

Set forum username