[web2py] Re: Weird problems generating menu from database

2017-08-16 Thread Вячеслав Анатольевич
Thank you so much, Massimo! That's what I need! -- 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

[web2py] Re: Weird problems generating menu from database

2017-08-15 Thread Massimo Di Pierro
Replace: response.menu = cache.ram('menu', lambda:build_menu(), None) # to cache it! with submenu = cache.ram('menu', lambda:build_menu(), None) # to cache it! response.menu =[('Main', False, URL('default', 'index'), submenu] On Monday, 14 August 2017 02:50:09 UTC-5, Вячеслав Анатольевич

[web2py] Re: Weird problems generating menu from database

2017-08-14 Thread Вячеслав Анатольевич
Hi! in that example - i have error: subsubmenu = [[key, None, link] for key, link in items] ValueError: too many values to unpack -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) -

[web2py] Re: Weird problems generating menu from database

2017-08-07 Thread Massimo Di Pierro
So I think... db = DAL('sqlite://storage.sqlite') db.define_table('map',Field('menu1'),Field('menu2'),Field('mnm_name'),Field( 'link')) import collections def build_menu(): m1, m2 = [], [] # to preserve orders m =

[web2py] Re: Weird problems generating menu from database

2017-08-07 Thread Вячеслав Анатольевич
> > In Wiki menus: > - Home > @index - Info > @info - web2py > http://www.web2py.com - - About us > @aboutus - - - Contact us > @contactus - If I add a third minus - THIS NOT WORKED! -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) -

[web2py] Re: Weird problems generating menu from database

2017-08-06 Thread Вячеслав Анатольевич
Thanks, Massimo! So, i have a database table - named "map", in that table - three field - menu1, menu2, mnm_name. Menu mast be like that: - menu1 - menu2 -mnm_name In menu1 - menu2, in menu2 - mnm_name -- Resources: - http://web2py.com - http://web2py.com/book

[web2py] Re: Weird problems generating menu from database

2017-08-04 Thread Massimo Di Pierro
Yes. It is possible but I am a little confused by your model to be able to provide an example that works for you. Can you please provide your model again an example of data that should comprise the menu? Notice what you seek is done here:

[web2py] Re: Weird problems generating menu from database

2017-08-02 Thread Dave S
On Wednesday, August 2, 2017 at 12:12:04 AM UTC-7, Вячеслав Анатольевич wrote: > > Me personally, no, but I understand BS3 limits the number of menu levels. >> >> /dps >> >> > > So, it is inpossible or not? I'm ask because it's hard to puzzle over > this or it's really impossible? > Sorry,

[web2py] Re: Weird problems generating menu from database

2017-08-02 Thread Вячеслав Анатольевич
> > Me personally, no, but I understand BS3 limits the number of menu levels. > > /dps > > So, it is inpossible or not? I'm ask because it's hard to puzzle over this or it's really impossible? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) -

[web2py] Re: Weird problems generating menu from database

2017-08-02 Thread Dave S
On Tuesday, August 1, 2017 at 11:21:03 PM UTC-7, Вячеслав Анатольевич wrote: > > Have some idea about this? > Me personally, no, but I understand BS3 limits the number of menu levels. /dps -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) -

[web2py] Re: Weird problems generating menu from database

2017-08-02 Thread Вячеслав Анатольевич
Have some idea about this? -- 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] Re: Weird problems generating menu from database

2017-08-01 Thread Вячеслав Анатольевич
I understood what was the matter, it was styling! But, how to add the third field: if auth.is_logged_in(): rows = db(db.map).select(db.map.menu1, db.map.menu2, db.map.mnm_name, orderby=db.map.num, distinct=True) from collections import defaultdict d = defaultdict(list) for row in rows:

[web2py] Re: Weird problems generating menu from database

2017-08-01 Thread Вячеслав Анатольевич
> > I'm using bootstrap css/js form wellcom app, about stupid.css - now > reading, but it's a little different, > I need to build a menu from the database table (three fields), as in the > example above. > Somthing like this: topmenu |menu |-sibmenu | |- submenu > > -- Resources: -

[web2py] Re: Weird problems generating menu from database

2017-08-01 Thread Dave S
On Monday, July 31, 2017 at 10:22:51 PM UTC-7, Вячеслав Анатольевич wrote: > > > Hi, Dave S, maybe you right! But How to create in submenuitem - > submenuitem? >> >> >> > Are you using the bootstrap css/js like the welcome app, or the stupic.css stuff from the examples app, or something

[web2py] Re: Weird problems generating menu from database

2017-07-31 Thread Вячеслав Анатольевич
Hi, Dave S, maybe you right! But How to create in submenuitem - submenuitem? > > > -- 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

[web2py] Re: Weird problems generating menu from database

2017-07-31 Thread Dave S
On Saturday, July 29, 2017 at 11:42:42 PM UTC-7, Вячеслав Анатольевич wrote: > > Thanks for the answer, Massimo! > > But this example makes the menu items in one line with one drop-down menu > item. > Like this: > > Menuitem Menuitem > - submenuitem- submenuitem

[web2py] Re: Weird problems generating menu from database

2017-07-30 Thread Вячеслав Анатольевич
Thanks for the answer, Massimo! But this example makes the menu items in one line with one drop-down menu item. Like this: Menuitem Menuitem - submenuitem- submenuitem I have three fields, they must be somthing like this (anothermenu - just for example - to

[web2py] Re: Weird problems generating menu from database

2017-07-29 Thread Massimo Di Pierro
Let me assume there is only one level and this cannot be arbitrarily nested. Also I assume the initial model of this thread: db.define_table('store_catalog', Field('maincategory', 'string'), Field('subcategory', 'string'), Field('description', 'text')) t = store_catalog rows =

[web2py] Re: Weird problems generating menu from database

2017-07-29 Thread Вячеслав Анатольевич
Hi! Paraphrase the question, can anyone explain how to create a drop-down menu from a database table or show a working example? -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) -

[web2py] Re: Weird problems generating menu from database

2017-07-27 Thread Вячеслав Анатольевич
> db.define_table('store_catalog', >> Field('title'), >> Field('slug',requires=IS_SLUG(),compute=lambda row: >> IS_SLUG.urlify(row.titl\ >> e)), >> Field('parent_id','reference store_catalog')) >> >> id1 = db.store_catalog.insert(title='main') >> id2 =

[web2py] Re: Weird problems generating menu from database

2014-01-29 Thread web2pygroup
Hi again all! Upon further trying to expand and experiment I stuck at something that maybe I need to be clarified on or I'm doing wrong. Basically what I did is create a store.py in that I specified the database exactly like it was in db.py (except. Then what I did in menu.py was simply

[web2py] Re: Weird problems generating menu from database

2014-01-23 Thread web2pygroup
After disabling the key constraints none of those errors about it have appeared. I am grateful for the assistance and will return it anyway I can. I will post a summary here for anyone attempting this also. Thanks a million! On Wednesday, January 22, 2014 12:03:26 PM UTC-6, web2pygroup

[web2py] Re: Weird problems generating menu from database

2014-01-22 Thread web2pygroup
That works great, thank you!!! My only remaining question is that when I try to edit the first record main in the appadmin I get the foreign key error. I read here - https://groups.google.com/forum/#!topic/web2py/klspqXpha4E - about how to disable it. Wasn't sure if I should do that or

[web2py] Re: Weird problems generating menu from database

2014-01-21 Thread americandewd
I attempted to copy/paste what you have so I can modify it for my needs. However it immediately errors out with: AttributeError: 'Table' object has no attribute 'parent' So I thought I would comment out everything for the menu except response.menu = [] and populate the database (have done

[web2py] Re: Weird problems generating menu from database

2014-01-21 Thread Massimo Di Pierro
First of all notice that if you use web2py2.8.2 you can do this: db.define_table('store_catalog', Field('title'), Field('slug',requires=IS_SLUG(),compute=lambda row: IS_SLUG.urlify(row.title)), Field('parent_id','reference store_catalog')) def menu_rec(items): return

[web2py] Re: Weird problems generating menu from database

2014-01-21 Thread web2pygroup
I am unable to make it past the point of the database definition. I put exactly what you have below in my db.py, and in my menu.py I left response.menu=[] so that I could populate the database because the function def menu_rec doesn't have anything so I thought to just avoid errors and for

[web2py] Re: Weird problems generating menu from database

2014-01-21 Thread web2pygroup
My code above seems to only be lacking the proper embedded if conditional statement. I am able to output the same info I need without repeating it like in this example: rows = db(db.store_categories).select() for menucatchoice in rows: if menucatchoice['subcategory'] == '': print

[web2py] Re: Weird problems generating menu from database

2014-01-21 Thread web2pygroup
Here's what I've tried so far and here's the results if it helps any to get me on the right track, plus I hope this helps someone else looking for this to because this is something very commonly done in PHP. I have tried changing this: response.menu3[-1]+=([[(T(subcat.subcategory)), False,

[web2py] Re: Weird problems generating menu from database

2014-01-21 Thread James Burke
Sorry, I had the parent declared as catelog_parent in the table. If you change it to parent it should work ;) Also += is the same as append. On Wednesday, January 22, 2014 3:35:29 AM UTC+13, web2pygroup wrote: I attempted to copy/paste what you have so I can modify it for my needs. However

[web2py] Re: Weird problems generating menu from database

2014-01-21 Thread web2pygroup
Getting: global name 'active_page' is not defined What did you have for that so I can incorporate it? Or do I even need that since I'm not really caring at the moment about which page they're on (if I understand that variable correctly). How would I remove it to still achieve the same

[web2py] Re: Weird problems generating menu from database

2014-01-21 Thread James Burke
You could simply declare it for testing purposes. Set it to false. -- 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

[web2py] Re: Weird problems generating menu from database

2014-01-21 Thread web2pygroup
Ok that works, and I'm curious about that variable if you could please explain maybe I could use it and not have to ask to many more questions :) Also I was wondering how I could incorporate what I had also posted originally - ([T(' Catalog'), False, '' - where this was the heading for the menu

[web2py] Re: Weird problems generating menu from database

2014-01-21 Thread web2pygroup
I decided to try and make Catalog my first choice in the menu by setting it as the first entry in the DB. Then I put Animals with Catalog as its parent, then I added Dogs and set that with Animals as the parent. Unfortunately it does not show the Dogs category. Have I possibly done

[web2py] Re: Weird problems generating menu from database

2014-01-21 Thread web2pygroup
I have also been trying your solution and have gotten to this point, when I try to run the shell to test it errors out immediately with: AttributeError: 'Rows' object has no attribute 'as_tree' Any hints on how to fix? Or something else I might try? I do have the 2.8.2 version.. I noticed

[web2py] Re: Weird problems generating menu from database

2014-01-21 Thread web2pygroup
Ok figured out I needed to change that to as_trees. However the database suggestion you gave is causing a IntegrityError: FOREIGN KEY constraint failed error immediately upon trying to put any data into any field. For example if I put Animals in the title and leave the other field parent_id

[web2py] Re: Weird problems generating menu from database

2014-01-21 Thread Massimo Di Pierro
Sorry typo. Let's try again: db.define_table('store_catalog', Field('title'), Field('slug',requires=IS_SLUG(),compute=lambda row: IS_SLUG.urlify(row.titl\ e)), Field('parent_id','reference store_catalog')) id1 = db.store_catalog.insert(title='main') id2 =

[web2py] Re: Weird problems generating menu from database

2014-01-20 Thread James Burke
Hi, I managed to get one working a little while ago doing this. This has been adapted for your situation, may require some tweaking: _tables.py - model db.define_table('store_catelog') db.define_table('store_catelog', Field('title', 'string'), Field('description', 'text'),