我有一个python django代码,我想使其在阅读和性能上更好,因为我想将其添加到我的辅助项目中,而我是python和django的新手。有人可以帮我吗
if "__repr__" in vars(cls):
# repr overriden in class. Don't mess with it
else:
cls.__repr__ = AutoRepr.__repr__
答案 0 :(得分:1)
//--------
render() {
let formIn = this.props.form; // JSON description of FORM
let formOut = null; // contructed REACT/Javascript form
switch (formIn.format) { // what type of operation is this
case 'accordion': { // Accordion in a FORM, OK
let children = this.pages(formIn.pages,
formIn.format); // build the children
formOut = React.createElement(Accordion, // construct the parent with ALL nested CHILDREN after
{key: formIn.formName}, // just a unique key
children); // N ACCORDION pages, N2 input fields
break;
}
case 'workflow': {
let children = this.pages(formIn.pages, // build the children
formIn.format); // build the children
formOut = React.createElement(Workflow, // and create the complex sheet element
{ key: formIn.formName},
children); // N SLIDING pages, N2 input fields
break;
}
case 'simple': {
let children = this.pages(formIn.pages, // build the children
formIn.format); // build the children
formOut = React.createElement(Simple,
{ key: formIn.formName},
children); // One page, N input fields
break;
}
}
return( <div>
{formOut}
</div>
);
}
}
export default SmartForm;
//----------------- EOF -------------------------------------------------