class Form(forms.Form): popup_view_field = PopupViewField(view_class=PopupView, callback_data=OrderedDict([ ('pk', 1), ('name', "Some name"), ('utf', "ąść"), ('escape', '&?') ]))
class DemoForm(forms.Form): name = forms.CharField(label="Name") sex = PopupViewField( # Attrs for popup view_class=SexPopupView, popup_dialog_title='What is your SEX', # Attr for CharField required=True, help_text='female or male') color = PopupViewField(view_class=ColorPopupView) country_code = PopupViewField(view_class=CountryPopupView) def __init__(self, *args, **kwargs): super(DemoForm, self).__init__(*args, **kwargs) self.helper = FormHelper()
class Form(forms.Form): popup_view_field = PopupViewField( view_class=PopupView, popup_dialog_title='Foo Bar Title Window', help_text='Test help text')
class Form(forms.Form): popup_view_field = PopupViewField(view_class=PopupView)
def test_callback_data_type_error(self): class PopupView(View): pass with self.assertRaises(AttributeError): PopupViewField(view_class=PopupView, callback_data="wrong type")
class Form1(forms.Form): field = PopupViewField(view_class=PopupView1, popup_dialog_title='Test PopupView1 Title')
class Form(forms.Form): popup_view_field = PopupViewField(view_class=PopupView, attrs={'readonly': True})