using appadmin for other models than db.py in web2py

48 views
Skip to first unread message

deepak sandhu

unread,
Dec 14, 2013, 1:01:44 PM12/14/13
to web...@googlegroups.com
in web2py we I created a new application called imageblog and in models on default I have 2 models :

    db.py
    menu.py
    coffee.py   #this is new one created by me in models i made some tables inside this too
and if I use the url 


I can see the appadmin of the db.py model but my question is I created another model called 
coffee.py how can I open coffee.py in appadmin?
I tried: 


I get output as : "invalid function (coffee/appadmin)"
but no luck.
Is appadmin only available for db.py ???

Massimo Di Pierro

unread,
Dec 14, 2013, 1:22:11 PM12/14/13
to web...@googlegroups.com
There is only one app for addpadmin:


It should give you access to all the models, including coffee.py

deepak sandhu

unread,
Dec 14, 2013, 1:35:16 PM12/14/13
to web...@googlegroups.com
Its giving me access to models inside db.py but not to models in coffee.py
I am attaching screenshots of both coffee.py and appadmin  this might help to clear.

inside coffee.py there is just one table 
appadmin.png
coffee.py.png

Anthony

unread,
Dec 14, 2013, 1:45:23 PM12/14/13
to web...@googlegroups.com
The problem is that you are defining db = DAL(...) in both coffee.py and db.py. Because db.py comes after coffee.py, the "db" object defined in coffee.py is simply replaced by the one defined in db.py, so none of the models in coffee.py will be available to any controller, including the appadmin controller.

You should define the "db" object only once, in the first model file that runs (model files run in alphanumeric order).

Anthony

deepak sandhu

unread,
Dec 14, 2013, 1:52:30 PM12/14/13
to web...@googlegroups.com
perfect it worked I was earlier trying to remove the db definition from coffee but it used to cause an error  as its should be in alpha numeric which I was ignoring


--
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 a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/CrmcJJnDCbc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply all
Reply to author
Forward
0 new messages