Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Radio button in form
#1
Hi,

I have a small web app which simply takes input via a form and executes a http POST request with the values entered to API.

this is my forms.py
rom django import forms

CHOICE = [('true', 'True'), ('false', 'False')]


class FeatureFlagsForm(forms.Form):
    tenants_id = forms.CharField(
        label='Tenant ID', max_length=40, required=True,
        widget=forms.TextInput(
            attrs={
                'placeholder': 'Enter Tenant ID (GUID)',
                'size': '50'
            })

    )

    is_allowed_to_access_staff = forms.ChoiceField(label='Tenant allowed to access staff?', choices=CHOICE,
                                                   widget=forms.RadioSelect)

    is_allowed_to_access_compliance = forms.ChoiceField(label='Tenant allowed to access compliance?', choices=CHOICE,
                                                        widget=forms.RadioSelect
                                                        )

    is_allowed_to_access_experts = forms.ChoiceField(label='Tenant allowed to access compliance?', choices=CHOICE,
                                                     widget=forms.RadioSelect
                                                     )

    should_auto_provision_users = forms.ChoiceField(label='Auto-provision users?', choices=CHOICE,
                                                    widget=forms.RadioSelect
                                                    )

    show_only_external_login = forms.ChoiceField(label='Show external login only?', choices=CHOICE,
                                                 widget=forms.RadioSelect
                                                 )

    show_tc_compliance_message = forms.ChoiceField(label='Tenant allowed to access compliance?', choices=CHOICE,
                                                   widget=forms.RadioSelect
                                                   )
my view:

    if form.is_valid():
        tenants_id = form.cleaned_data.get('tenants_id')
        access_staff = form.cleaned_data.get('access_staff')
        access_compliance = form.cleaned_data.get('access_compliance')
        auto_provision_users = form.cleaned_data.get('auto_provision_users')
        show_ext_login = form.cleaned_data.get('show_ext_login')
however when I print access_staff for example I get <class 'NoneType'>



Why is the input from the form of type "NonceType" ???
Reply


Messages In This Thread
Radio button in form - by Heinrich - Jan-14-2020, 04:26 AM
RE: Radio button in form - by Heinrich - Jan-14-2020, 05:41 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Contact form button click action Man_from_India 1 2,920 Feb-01-2020, 06:21 PM
Last Post: snippsat
  form fill & button clicks rudolphyaber 3 4,725 Apr-25-2019, 06:32 PM
Last Post: Larz60+
  Submit button not working when using form tuannv562 0 5,659 Apr-23-2018, 03:49 AM
Last Post: tuannv562

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020