from django import forms

from .models import Config

class ConfigForm(forms.ModelForm):
    class Meta:
        model = Config
        exclude = ('created', 'user')

PAGES = (
    ('base',),
    ('distribution',),
    ('media_type',),
    ('architecture',),
    ('installer',),
    ('locale', 'keyboard_layout'),
)

WIZARD_FORMS = []
for fields in PAGES:
    meta = type('Meta', (), {
        'model': Config,
        'fields': fields,
    })

    WIZARD_FORMS.append(type('', (forms.ModelForm,), {'Meta': meta}))

from django import forms

from .models import Config

class ConfigForm(forms.ModelForm):
    class Meta:
        model = Config
        exclude = ('created', 'user')

PAGES = (
    ('base',),
    ('distribution',),
    ('media_type',),
    ('architecture',),
    ('installer',),
    ('locale', 'keyboard_layout'),
)

WIZARD_FORMS = []
for fields in PAGES:
    meta = type('Meta', (), {
        'model': Config,
        'fields': fields,
        'widgets': {
            'base': forms.RadioSelect(),
            'distribution': forms.RadioSelect(),
            'media_type': forms.RadioSelect(),
            'architecture': forms.RadioSelect(),
            'installer': forms.RadioSelect(),
        },
    })

    WIZARD_FORMS.append(type('', (forms.ModelForm,), {'Meta': meta}))

Use radio buttons for most of the interface.
Use radio buttons for most of the interface.

Signed-off-by: Chris Lamb <29e6d179a8d73471df7861382db6dd7e64138033@debian.org>

  from django import forms
  
  from .models import Config
  
  class ConfigForm(forms.ModelForm):
      class Meta:
          model = Config
          exclude = ('created', 'user')
  
  PAGES = (
      ('base',),
      ('distribution',),
      ('media_type',),
      ('architecture',),
      ('installer',),
      ('locale', 'keyboard_layout'),
  )
  
  WIZARD_FORMS = []
  for fields in PAGES:
      meta = type('Meta', (), {
          'model': Config,
          'fields': fields,
+         'widgets': {
+             'base': forms.RadioSelect(),
+             'distribution': forms.RadioSelect(),
+             'media_type': forms.RadioSelect(),
+             'architecture': forms.RadioSelect(),
+             'installer': forms.RadioSelect(),
+         },
      })
  
      WIZARD_FORMS.append(type('', (forms.ModelForm,), {'Meta': meta}))
  
Use radio buttons for most of the interface.
## Code Before:
from django import forms

from .models import Config

class ConfigForm(forms.ModelForm):
    class Meta:
        model = Config
        exclude = ('created', 'user')

PAGES = (
    ('base',),
    ('distribution',),
    ('media_type',),
    ('architecture',),
    ('installer',),
    ('locale', 'keyboard_layout'),
)

WIZARD_FORMS = []
for fields in PAGES:
    meta = type('Meta', (), {
        'model': Config,
        'fields': fields,
    })

    WIZARD_FORMS.append(type('', (forms.ModelForm,), {'Meta': meta}))

## Instruction:
Use radio buttons for most of the interface.
## Code After:
from django import forms

from .models import Config

class ConfigForm(forms.ModelForm):
    class Meta:
        model = Config
        exclude = ('created', 'user')

PAGES = (
    ('base',),
    ('distribution',),
    ('media_type',),
    ('architecture',),
    ('installer',),
    ('locale', 'keyboard_layout'),
)

WIZARD_FORMS = []
for fields in PAGES:
    meta = type('Meta', (), {
        'model': Config,
        'fields': fields,
        'widgets': {
            'base': forms.RadioSelect(),
            'distribution': forms.RadioSelect(),
            'media_type': forms.RadioSelect(),
            'architecture': forms.RadioSelect(),
            'installer': forms.RadioSelect(),
        },
    })

    WIZARD_FORMS.append(type('', (forms.ModelForm,), {'Meta': meta}))
