I’m not that familiar with MultiWidget, but it would seem that your print 
statement should be:
print(fourteen.mywidget)

From: django-users@googlegroups.com [mailto:django-users@googlegroups.com] On 
Behalf Of Farhan Khan
Sent: Monday, December 19, 2016 11:40 AM
To: Django users
Subject: MultiWidget not rendering

Hi all!
I am trying to get a MultiWidget with two TextFields ,however I am not able to 
get anything to render. Here is my code.


from django import forms
from django.forms import widgets

class DateSelectorWidget(widgets.MultiWidget):
    def __init__(self, attrs=None):
        _widgets = (forms.TextInput(),
                    forms.TextInput())
        super(DateSelectorWidget, self).__init__(_widgets, attrs)

    def format_output(self, rendered_widgets):
        return ''.join(rendered_widgets)

class Fourteen(forms.Form):
    mywidget = DateSelectorWidget()

In the shell I will do:

>>> fourteen = Fourteen()
>>> print(fourteen)

>>>

Nothing will render. I suspect that I need to manually render the HTML, but the 
documentation<https://docs.djangoproject.com/en/1.10/ref/forms/widgets/#multiwidget>
 is fairly light on this topic.

Any assistance would be greatly appreciated!
--
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
django-users+unsubscr...@googlegroups.com<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to 
django-users@googlegroups.com<mailto:django-users@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/86bebdb4-1d45-4612-84d1-456f86942709%40googlegroups.com<https://groups.google.com/d/msgid/django-users/86bebdb4-1d45-4612-84d1-456f86942709%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/ebd9f58fca3a4009abcfd05e16fca9dc%40ISS1.ISS.LOCAL.
For more options, visit https://groups.google.com/d/optout.

Reply via email to