I try to use a switch in my model, but it just doesn’t output anything when I do an override this way (it just prints a shortcut in my form and not a radio buttosn, if I do not do an override it makes a standard checkbox)
My modelfield is defined as:
Class Mymodelname (models.Model):
fieldname = models.BooleanField(max_length=1, verbose_name='ECG')
My model form is defined as such:
from django.forms import ModelForm
from django import forms
from web1.myappname.models import Mymodelname
class createdbentry(forms.ModelForm):
choices = ( (1,'Yes'),
(0,'No'),
)
fieldname = forms.ChoiceField(widget=forms.RadioSelect
(choices=choices))
I would really appreciate any advice on what I'm doing wrong. thank
class Meta:
model = Mymodelname
source
share