Exemple #1
0
class MTurkCreateHITForm(forms.Form):

    use_sandbox = forms.BooleanField(
        required=False,
        label='Use MTurk Sandbox (for development and testing)',
        help_text=("If this box is checked, your HIT will not be published to "
                   "the MTurk live site, but rather to the MTurk Sandbox, "
                   "so you can test how it will look to MTurk workers."))
    title = forms.CharField()
    description = forms.CharField()
    keywords = forms.CharField()
    money_reward = forms.RealWorldCurrencyField(
        # it seems that if this is omitted, the step defaults to an integer,
        # meaninng fractional inputs are not accepted
        widget=widgets._RealWorldCurrencyInput(attrs={'step': 0.01}))
    assignments = forms.IntegerField(
        label="Number of assignments",
        help_text="How many unique Workers do you want to work on the HIT?")
    minutes_allotted_per_assignment = forms.IntegerField(
        label="Minutes allotted per assignment",
        help_text=("Number of minutes, that a Worker has to "
                   "complete the HIT after accepting it."))
    expiration_hours = forms.FloatField(
        label="Hours until HIT expiration",
        help_text=("Number of hours after which the HIT "
                   "is no longer available for users to accept. "))

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)
        self.fields['assignments'].widget.attrs['readonly'] = True
Exemple #2
0
class WidgetDemoForm(forms.Form):
    char = forms.CharField(required=False)

    text = forms.CharField(required=False, widget=forms.Textarea)

    radio_select = forms.ChoiceField(choices=default_choices,
                                     widget=forms.RadioSelect)
    radio_select_horizontal = forms.ChoiceField(
        choices=default_choices, widget=forms.RadioSelectHorizontal)
    checkbox_select = forms.MultipleChoiceField(
        choices=default_choices, widget=forms.CheckboxSelectMultiple)
    checkbox_select_horizontal = forms.MultipleChoiceField(
        choices=default_choices, widget=forms.CheckboxSelectMultipleHorizontal)

    currency = forms.CurrencyField()
    currency_choice = forms.CurrencyChoiceField(
        choices=[(m, m) for m in currency_range(0, 0.75, 0.05)])

    slider = forms.IntegerField(widget=widgets.SliderInput())
    unprecise_slider = forms.IntegerField(widget=widgets.SliderInput(
        show_value=False))
    precise_slider = forms.FloatField(widget=widgets.SliderInput(attrs={
        'min': 1,
        'max': 50,
        'step': 0.01
    }))
Exemple #3
0
class MTurkCreateHITForm(forms.Form):

    in_sandbox = forms.BooleanField(
        required=False,
        help_text="Do you want HIT published on MTurk sandbox?")
    title = forms.CharField()
    description = forms.CharField()
    keywords = forms.CharField()
    money_reward = forms.RealWorldCurrencyField(
        # it seems that if this is omitted, the step defaults to an integer,
        # meaninng fractional inputs are not accepted
        widget=widgets.RealWorldCurrencyInput(attrs={'step': 0.01})
    )
    assignments = forms.IntegerField(
        label="Number of assignments",
        help_text="How many unique Workers do you want to work on the HIT?")
    minutes_allotted_per_assignment = forms.IntegerField(
        label="Minutes allotted per assignment",
        help_text=(
            "Number of minutes, that a Worker has to "
            "complete the HIT after accepting it."
        ))
    expiration_hours = forms.FloatField(
        label="Hours until HIT expiration",
        help_text=(
            "Number of hours after which the HIT "
            "is no longer available for users to accept. "
        ))

    def __init__(self, *args, **kwargs):
        super(MTurkCreateHITForm, self).__init__(*args, **kwargs)
        self.fields['assignments'].widget.attrs['readonly'] = True
Exemple #4
0
class SessionEditPropertiesForm(forms.Form):
    participation_fee = forms.RealWorldCurrencyField(
        required=False,
        # it seems that if this is omitted, the step defaults to an integer,
        # meaninng fractional inputs are not accepted
        widget=widgets._RealWorldCurrencyInput(attrs={'step': 0.01}),
    )
    real_world_currency_per_point = forms.FloatField(required=False)

    label = forms.CharField(required=False)
    comment = forms.CharField(required=False)
Exemple #5
0
class SessionEditPropertiesForm(forms.ModelForm):
    participation_fee = forms.RealWorldCurrencyField(
        required=False,
        # it seems that if this is omitted, the step defaults to an integer,
        # meaninng fractional inputs are not accepted
        widget=widgets._RealWorldCurrencyInput(attrs={'step': 0.01}))
    real_world_currency_per_point = forms.FloatField(required=False)

    class Meta:
        model = Session
        fields = [
            'label',
            'experimenter_name',
            'comment',
        ]