On Friday, February 16, 2018 at 2:10:38 PM UTC-8, Bryan Nahrwold wrote:
>
> I am assuming this is so obvious that you don't feel the need to state it 
> explicitly, but where the heck does the manager code go in the book  code 
> 3.3.2 Adding Grids?
>
>
This is just a controller function, so it can go in any file in the 
controllers directory.   Since it is meant to be directly accessible (by 
the authorized users) via a URL, it should not go in the models or modules 
directories.


I've tried several file locations which all don't work.
>
> The book states on page 105-106 (version 
> 2.16.1-stable+timestamp.2017.11.14.05.54.25):
>
> We can improve this further using the SQLFORM.grid and SQLFORM.smartgrid 
> gadgets to create a management interface for our application:
>
> @auth.requires_membership('manager')
> def manage():
>     grid = SQLFORM.smartgrid(db.image, linked_tables=['post'])
>     return dict(grid=grid)
>
> with associated "views/default/manage.html".
>  
>

> You have a great book, However, I find it exasperating how many times you 
> do not explicitly state where code should go.
> EVERY SINGLE code entry should have an explicit listing of the file it is 
> supposed to go into. That really shouldn't be difficult.
>
> I have actually had to go to some third party web2py tutorials to try and 
> figure some of this stuff out. Some of these third party tutorials DO give 
> explicit file paths for EVERY code segment, can't you?
>
> Please try to put yourself in the place of a beginner. The architecture is 
> still not clear and your new readers may be digesting the book over periods 
> of time with lapses in between readings. I shouldn't have to reread the 
> last five pages every time I pick up the book again just to get a relative 
> reference to tell me where the file resides that you are talking about 
> modifying.
>
> I like this product but find these repeated vague references to code 
> locations an impediment to adoption of this product.
>

In general, something that corresponds to a URL goes in a controller, 
something that is shared by controllers goes in a module, and something 
that defines a table goes in a model.  (There are some times when a table 
definition gets moved to a module, for overhead reasons.)

Also note that many of the examples are done by running web2py -M -S myapp 
to open an interactive shell, and viewing the results on the console.

/dps

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to