Py4web Documentation Release 1.20210619.1
Total Page:16
File Type:pdf, Size:1020Kb
py4web Documentation Release 1.20210619.1 © 2020, BSDv3 License July 04, 2021 Table of Contents 1 What is py4web? 1 1.1 Acknowledgments . 2 2 Help, resources and hints 5 2.1 Resources . 5 2.2 Hints and tips . 6 2.3 How to contribute . 6 3 Installation and Startup 9 3.1 Understanding the design . 9 3.2 Supported platforms and prerequisites . 9 3.3 Setup procedures . 9 3.4 Upgrading . 11 3.5 First run . 12 3.6 Command line options . 13 3.7 Special deployments . 16 4 The Dashboard 19 4.1 The main Web page . 19 4.2 Login into the Dashboard . 20 5 Creating your first app 25 5.1 From scratch . 25 5.2 Static web pages . 25 5.3 Dynamic Web Pages . 26 5.4 The _scaffold app . 29 5.5 Copying the _scaffold app . 30 5.6 Watch for files change . 31 6 Fixtures 33 6.1 Using Fixtures . 33 6.2 The Template fixture . 34 6.3 The Translator fixture . 34 6.4 The Flash fixture . 36 6.5 The Session fixture . 37 6.6 The URLsigner fixture . 40 6.7 The DAL fixture . 40 i 6.8 The Auth fixture . 41 6.9 Caveats about fixtures . 41 6.10 Custom fixtures . 42 6.11 Caching and Memoize . 43 6.12 Convenience Decorators . 43 7 The Database Abstraction Layer (DAL) 45 7.1 DAL introduction . 45 7.2 DAL constructor . 48 7.3 Table constructor . 53 7.4 Field constructor . 57 7.5 Migrations . 62 7.6 Table methods . 64 7.7 Raw SQL . 67 7.8 select command . 69 7.9 Computed and Virtual fields . 81 7.10 Joins and Relations . 84 7.11 Other operators . 89 7.12 Exporting and importing data . 93 7.13 Advanced features . 98 7.14 Gotchas . 104 8 The RESTAPI 111 8.1 RestAPI GET . 112 9 YATL Template Language 129 9.1 Basic syntax . 130 9.2 Information workflow . 133 9.3 Page layout standard structure . 137 10 YATL helpers 141 10.1 Helpers overview . 141 10.2 Built-in helpers . 143 10.3 Custom helpers . 149 10.4 Server-side DOM . 149 11 Internationalization 153 11.1 Pluralize . 153 11.2 Update the translation files . 154 12 Forms 155 12.1 The Form constructor . 155 12.2 A minimal form example . 156 12.3 Form basic example . 157 12.4 Form Structure Manipulation . 158 12.5 Form validation . 159 13 Authentication and Access control 177 13.1 Auth UI . 178 13.2 Using Auth . 178 13.3 Auth Plugins . 179 13.4 Tags and Permissions . 180 ii 14 Grid 183 14.1 Key Features . 183 14.2 Basic Example . 183 14.3 Signature . 184 14.4 Searching / Filtering . 185 14.5 CRUD . 185 14.6 Using templates . 186 14.7 Customizing Style . 186 14.8 Custom Action Buttons . 190 14.9 Sample Action Button Class . 190 14.10 Reference Fields . ..