资源说明:An enhanced class based on MultiWidget that lets you easily control the rendering using a layout
# django-MultiWidgetLayout * Author: Miguel Araujo * Licence: BSD ## Usage This is an enhanced class based on `MultiWidget` that lets you control the rendering of a subclass using a layout specified by a list. Let's see an example first: class AddressWidget(MultiWidgetLayout): def __init__(self, attrs=None): layout = [ "", TextInput() "", TextInput(), "", TextInput() ] super(AddressWidget, self).__init__(layout, attrs) def decompress(self, value): if value: return value.split(",") return [None, None, None] This is what you get: Compared to `MultiWidget`, the differences are: * `widgets` parameter no longer exists. * `layout` The layout is a list of strings and widgets that will be rendered. They are rendered in that exact order. String will be formatted using the dictionary `attrs`. ## Bugs or Suggestions This is an experiment to improve the rendering of MultiWidgets. I have openned a ticket in Django (#16959) to see if the concept is accepted, meanwhile you can use this. If you have suggestions or you come across bugs, please open an issue.
本源码包内暂不包含可直接显示的源代码文件,请下载源码包。
English
