#20209: fields is empty after post with RadioWidget -----------------------------------+-------------------- Reporter: strelnikovdmitrij | Owner: nobody Type: Bug | Status: new Component: Forms | Version: master Severity: Normal | Keywords: Triage Stage: Unreviewed | Has patch: 0 Easy pickings: 0 | UI/UX: 0 -----------------------------------+-------------------- ---forms.py--- class ApplicantForm(forms.ModelForm): # gender = forms.ChoiceField(choices=Gender.CHOICES, widget=forms.RadioSelect)
class Meta: exclude = (...) model = Applicant widgets = { 'gender': forms.RadioSelect, } ---view.py--- def compose_full(request, tmpl='applicant/compose.html'): data = {} applicant = Applicant() applicant.created_by = request.user applicant.ip = get_ip(request) appl_frm = ApplicantForm(request.POST or None, instance=applicant) att_frm = AppCVForm(request.POST or None, request.FILES or None) if appl_frm.is_valid() and att_frm.is_valid(): .... ---models.py--- class Applicant(models.Model): ... gender = models.IntegerField(choices=Gender.CHOICES, default=Gender.UNSPECIFIED) ... after POST form, no value of gender is selected all works fine with default widget, if change widget to Meta class, or change it in form __init__ method, or define it in form class (commented line) RadioSelect or RadioSelect() providing same result (if no exception is raised) -- Ticket URL: <https://code.djangoproject.com/ticket/20209> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.