You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
</code></pre></div></td></tr></table></div></div></div></div><detailsclass=example><summary>See Interface</summary><p><fontsize=4><strong>Parameters</strong></font></p><table><thead><tr><th>Name</th><th>Type</th><th>Description</th><th>Default</th></tr></thead><tbody><tr><td><codeclass=highlight><spanclass=n>view</span></code></td><td><codeclass=highlight><spanclass=n>Callable</span><spanclass=o>|</span><spanclass=n>View</span><spanclass=o>|</span><spanclass=nb>str</span></code></td><td>The view to convert, or the view's dotted path as a string.</td><td>N/A</td></tr><tr><td><codeclass=highlight><spanclass=n>transforms</span></code></td><td><codeclass=highlight><spanclass=n>Sequence</span><spanclass=p>[</span><spanclass=n>Callable</span><spanclass=p>[[</span><spanclass=n>VdomDict</span><spanclass=p>],</span><spanclass=n>Any</span><spanclass=p>]]</span></code></td><td>A list of functions that transforms the newly generated VDOM. The functions will be called on each VDOM node.</td><td><codeclass=highlight><spanclass=nb>tuple</span></code></td></tr><tr><td><codeclass=highlight><spanclass=n>strict_parsing</span></code></td><td><codeclass=highlight><spanclass=nb>bool</span></code></td><td>If <codeclass=highlight><spanclass=kc>True</span></code>, an exception will be generated if the HTML does not perfectly adhere to HTML5.</td><td><codeclass=highlight><spanclass=kc>True</span></code></td></tr></tbody></table><p><fontsize=4><strong>Returns</strong></font></p><table><thead><tr><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><codeclass=highlight><spanclass=n>constructor</span></code></td><td>A function that takes <codeclass=highlight><spanclass=n>request</span><spanclass=p>,</span><spanclass=o>*</span><spanclass=n>args</span><spanclass=p>,</span><spanclass=n>key</span><spanclass=p>,</span><spanclass=o>**</span><spanclass=n>kwargs</span></code> and returns a ReactPy component. Note that <codeclass=highlight><spanclass=o>*</span><spanclass=n>args</span></code> and <codeclass=highlight><spanclass=o>**</span><spanclass=n>kwargs</span></code> are directly provided to your view.</td></tr></tbody></table></details><detailsclass=info><summary>Existing limitations</summary><p>There are currently several limitations of using <codeclass=highlight><spanclass=n>view_to_component</span></code> that may be resolved in a future version.</p><ul><li>Requires manual intervention to change HTTP methods to anything other than <code>GET</code>.</li><li>ReactPy events cannot conveniently be attached to converted view HTML.</li><li>Has no option to automatically intercept local anchor link (such as <codeclass=highlight><spanclass=p><</span><spanclass=nt>a</span><spanclass=na>href</span><spanclass=o>=</span><spanclass=s>'example/'</span><spanclass=p>></</span><spanclass=nt>a</span><spanclass=p>></span></code>) click events.</li></ul></details><detailsclass=question><summary>How do I use this for Class Based Views?</summary><p>Class Based Views are accepted by <codeclass=highlight><spanclass=n>view_to_component</span></code> as an argument.</p><p>Calling <codeclass=highlight><spanclass=n>as_view</span><spanclass=p>()</span></code> is optional, but recommended.</p><divclass="tabbed-set tabbed-alternate" data-tabs=10:2><inputchecked=checkedid=__tabbed_10_1name=__tabbed_10type=radio><inputid=__tabbed_10_2name=__tabbed_10type=radio><divclass=tabbed-labels><labelfor=__tabbed_10_1>components.py</label><labelfor=__tabbed_10_2>views.py</label></div><divclass=tabbed-content><divclass=tabbed-block><divclass=highlight><tableclass=highlighttable><tr><tdclass=linenos><divclass=linenodiv><pre><span></span><spanclass=normal> 1</span>
309
+
</code></pre></div></td></tr></table></div></div></div></div><detailsclass=example><summary>See Interface</summary><p><fontsize=4><strong>Parameters</strong></font></p><table><thead><tr><th>Name</th><th>Type</th><th>Description</th><th>Default</th></tr></thead><tbody><tr><td><codeclass=highlight><spanclass=n>view</span></code></td><td><codeclass=highlight><spanclass=n>Callable</span><spanclass=o>|</span><spanclass=n>View</span><spanclass=o>|</span><spanclass=nb>str</span></code></td><td>The view to convert, or the view's dotted path as a string.</td><td>N/A</td></tr><tr><td><codeclass=highlight><spanclass=n>transforms</span></code></td><td><codeclass=highlight><spanclass=n>Sequence</span><spanclass=p>[</span><spanclass=n>Callable</span><spanclass=p>[[</span><spanclass=n>VdomDict</span><spanclass=p>],</span><spanclass=n>Any</span><spanclass=p>]]</span></code></td><td>A list of functions that transforms the newly generated VDOM. The functions will be called on each VDOM node.</td><td><codeclass=highlight><spanclass=nb>tuple</span></code></td></tr><tr><td><codeclass=highlight><spanclass=n>strict_parsing</span></code></td><td><codeclass=highlight><spanclass=nb>bool</span></code></td><td>If <codeclass=highlight><spanclass=kc>True</span></code>, an exception will be generated if the HTML does not perfectly adhere to HTML5.</td><td><codeclass=highlight><spanclass=kc>True</span></code></td></tr></tbody></table><p><fontsize=4><strong>Returns</strong></font></p><table><thead><tr><th>Type</th><th>Description</th></tr></thead><tbody><tr><td><codeclass=highlight><spanclass=n>constructor</span></code></td><td>A function that takes <codeclass=highlight><spanclass=n>request</span><spanclass=p>,</span><spanclass=o>*</span><spanclass=n>args</span><spanclass=p>,</span><spanclass=n>key</span><spanclass=p>,</span><spanclass=o>**</span><spanclass=n>kwargs</span></code> and returns a ReactPy component. Note that <codeclass=highlight><spanclass=o>*</span><spanclass=n>args</span></code> and <codeclass=highlight><spanclass=o>**</span><spanclass=n>kwargs</span></code> are directly provided to your view.</td></tr></tbody></table></details><detailsclass=info><summary>Existing limitations</summary><p>There are currently several limitations of using <codeclass=highlight><spanclass=n>view_to_component</span></code> that may be resolved in a future version.</p><ul><li>Requires manual intervention to change HTTP methods to anything other than <code>GET</code>.</li><li>ReactPy events cannot conveniently be attached to converted view HTML.</li><li>Has no option to automatically intercept click events from hyperlinks (such as <codeclass=highlight><spanclass=p><</span><spanclass=nt>a</span><spanclass=na>href</span><spanclass=o>=</span><spanclass=s>'example/'</span><spanclass=p>></</span><spanclass=nt>a</span><spanclass=p>></span></code>).</li></ul></details><detailsclass=question><summary>How do I use this for Class Based Views?</summary><p>Class Based Views are accepted by <codeclass=highlight><spanclass=n>view_to_component</span></code> as an argument.</p><p>Calling <codeclass=highlight><spanclass=n>as_view</span><spanclass=p>()</span></code> is optional, but recommended.</p><divclass="tabbed-set tabbed-alternate" data-tabs=10:2><inputchecked=checkedid=__tabbed_10_1name=__tabbed_10type=radio><inputid=__tabbed_10_2name=__tabbed_10type=radio><divclass=tabbed-labels><labelfor=__tabbed_10_1>components.py</label><labelfor=__tabbed_10_2>views.py</label></div><divclass=tabbed-content><divclass=tabbed-block><divclass=highlight><tableclass=highlighttable><tr><tdclass=linenos><divclass=linenodiv><pre><span></span><spanclass=normal> 1</span>
0 commit comments