Store JS lists as Django model

108 views
Skip to first unread message

Nicholas L

unread,
Apr 6, 2021, 10:13:37 AM4/6/21
to oTree help & discussion

Hello,

Is oTree compatible with storing lists in model cells? I tried importing django.contrib.postgres.fields and djanog.mysql.models and then using LongTextField() or ArrayField(), but they did not seem to work. I am trying to store a dynamic range of performance.now() times from an .onclick function into an JS array to then pass onto a django model.

Cheers,

Nicholas

Chris @ oTree

unread,
Apr 6, 2021, 10:17:03 AM4/6/21
to Nicholas L, oTree help & discussion
A few options:
- ExtraModel
- participant.vars
- LongStringField (json encoded)

Sent from my phone

On Apr 6, 2021, at 10:13 PM, Nicholas L <nicholaslaco...@gmail.com> wrote:


--
You received this message because you are subscribed to the Google Groups "oTree help & discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to otree+un...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/otree/3ca8884d-20da-46a0-a9f4-9e804b68c425n%40googlegroups.com.

Nicholas L

unread,
Apr 6, 2021, 12:00:42 PM4/6/21
to oTree help & discussion
Ok, thanks! I got it to work with LongStringField(). Quick question: is there a max length on the LongStringField()? At the very most, I will have a participant with a list containing 1000 elements of performance.now() values that get converted to a comma-separated string. Will this be a problem for variable storage limits or server load?

Chris @ oTree

unread,
Apr 6, 2021, 12:05:20 PM4/6/21
to Nicholas L, oTree help & discussion
Should be fine. 

Sent from my phone

On Apr 7, 2021, at 12:00 AM, Nicholas L <nicholaslaco...@gmail.com> wrote:

Ok, thanks! I got it to work with LongStringField(). Quick question: is there a max length on the LongStringField()? At the very most, I will have a participant with a list containing 1000 elements of performance.now() values that get converted to a comma-separated string. Will this be a problem for variable storage limits or server load?
Reply all
Reply to author
Forward
0 new messages