def test_html_factory(self): input = wsgi.html_factory('input', type='text') h = input(value='bla') self.assertTrue(h) self.assertEqual(h.attr('value'), 'bla') self.assertEqual(h.attr('type'), 'text') text = h.to_string() self.assertTrue(" type='text'" in text) self.assertTrue(" value='bla'" in text)
def test_html_factory(self): input = wsgi.html_factory('input', type='text') h = input(value='bla') self.assertTrue(h) self.assertEqual(h.attr('value'), 'bla') self.assertEqual(h.attr('type'), 'text') text = h.render() self.assertTrue(" type='text'" in text) self.assertTrue(" value='bla'" in text)
from copy import copy from itertools import zip_longest from pulsar.utils.string import to_string from pulsar.apps.wsgi import html_factory from .fields import CharField, ValidationError __all__ = ['FormSet'] HiddenInput = html_factory('input', type='hidden') class FormSet(object): '''A factory class for foreign keys model fields. Instances of this class are declared in the body of a :class:`Form`. :parameter form_class: A :class:`Form` class which generates forms. :parameter model: A model class which generate instances from form data. :parameter related_name: The field attribute name in ``model`` which specifies the related model. :parameter clean: A function which takes the formset instance as parameter and perform the last validation check on all forms. Default ``None``. :parameter instances_from_related: a callable for retrieving instances from the related instance. Default ``None``. :parameter initial_length: The initial number of forms. This is the number
from copy import copy from itertools import zip_longest from pulsar.utils.string import to_string from pulsar.apps.wsgi import html_factory from .fields import CharField, ValidationError __all__ = ['FormSet'] HiddenInput = html_factory('input', type='hidden') class FormSet(object): '''A factory class for foreign keys model fields. Instances of this class are declared in the body of a :class:`Form`. :parameter form_class: A :class:`Form` class which generates forms. :parameter model: A model class which generate instances from form data. :parameter related_name: The field attribute name in ``model`` which specifies the related model. :parameter clean: A function which takes the formset instance as parameter and perform the last validation check on all forms. Default ``None``. :parameter instances_from_related: a callable for retrieving instances from the related instance. Default ``None``.