# -*- coding: utf-8 -*- # from __future__ import division import random import otree.models from otree.db import models from otree import widgets from otree.common import Currency as c, currency_range, safe_json from otree.constants import BaseConstants from otree.models import BaseSubsession, BaseGroup, BasePlayer author = 'Thorben Woelk, Sophia Wagner' doc = """ Big 5 Personality Inventory short (BFI-S). Gerlitz, J. Y., & Schupp, J. (2005). Zur Erhebung der Big-Five-basierten persoenlichkeitsmerkmale im SOEP. DIW Research Notes, 4, 2005. """ class Constants(BaseConstants): name_in_url = 'big5s' players_per_group = None num_rounds = 1 NUMBERS = range(1, 16, 1) NAMES = [ " works thoroughly.", " is communicative, chatty.", " is sometimes a little rude to others.", " is original, has new ideas.", " worries oftentimes.", " can forgive.", " is rather lazy.", " can come out of my shell and is sociable.", " appreciates artistic experiences.", " gets easily nervous.", " gets jobs done effectively and efficiently.", " is conservative, reticent.", " is considerate and treats others friendly.", " has a vivid imagination, phantasy.", " is relaxed, can handle stress well." ] SCALE = [1, 2, 3, 4, 5, 6, 7] class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): # Screen: Big5S i = None # Loop: From 1 to 15 for i in range(1, 16): # Add: Variables for every step to data base (not nice, but it works) locals()[f'big5s_{i}'] = models.IntegerField( choices=Constants.SCALE, widget=widgets.RadioSelectHorizontal, verbose_name=Constants.NAMES[i - 1] ) # Delete: Auxiliary variables to prevent oTree error del i