Re: [web2py] Re: Got error when I put 'fields' as an argument to SQLFORM.grid

2021-01-28 Thread valq...@gmail.com
db.table['fieldname']


четверг, 28 января 2021 г. в 07:31:04 UTC+3, at: 

> It gives error: `*AttributeError('str' object has no attribute 
> 'tablename')*`
>
> The reason is that the field names are in string format not in 
> db.tablename.fieldname format
>
>
> On Wed, Jan 27, 2021 at 6:30 PM Jim Steil  wrote:
>
>> What is wrong with using the example you provided?
>>
>> -Jim
>>
>>
>> On Tue, Jan 26, 2021 at 10:45 PM Muhammad Atif Ayaz  
>> wrote:
>>
>>> Thank you Jim, it works.
>>>
>>> Do you think a way that can help dynamically making a list of all fields 
>>> of a table and then we can remove specific fields from it.
>>> Like the following which produces the required list but in the desired 
>>> data-type: 
>>> fields = [fld for fld in db.engagement.fields if fld!='token']
>>> grid = SQLFORM.grid(db.engagement, fields=fields)
>>>
>>>
>>> On Tue, Jan 26, 2021 at 9:50 PM Jim S  wrote:
>>>
 Can you try with the field in the format:

 db.tablename.fieldname

 ex:

 fields = [db.engagement.id, db.engagement.name]

 -Jim


 On Monday, January 25, 2021 at 11:45:49 PM UTC-6 at wrote:

> Here is the code:
> `fields=['id', 'name']`
> `grid = SQLFORM.grid(db.engagement, fields=fields)`
>
> Error:
> `AttributeError('str' object has no attribute 'tablename')`
>
>
> -- 
 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/Ym3zsLYNePg/unsubscribe.
 To unsubscribe from this group and all its topics, send an email to 
 web2py+un...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/web2py/e19daf19-95c7-4e46-88da-74882bd4e51an%40googlegroups.com
  
 
 .

>>> -- 
>>> 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/Ym3zsLYNePg/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to 
>>> web2py+un...@googlegroups.com.
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/web2py/CAFpY7yFSRZMRPY02sHJtxGasp3T%3Dy7sRdqbq58KncYDdDpkXDg%40mail.gmail.com
>>>  
>>> 
>>> .
>>>
>> -- 
>> 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/Ym3zsLYNePg/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to 
>> web2py+un...@googlegroups.com.
>>
> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/web2py/CAERBpoCjJrCe_3W1Nq%3DZKh8wFc-e8stoHOpMzDwxMHfbFjexKA%40mail.gmail.com
>>  
>> 
>> .
>>
>

-- 
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 web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/3b718aef-ec6a-45d3-9c6a-7ae039ae787an%40googlegroups.com.


[web2py] Re: fake_migration issues

2021-01-28 Thread Dave S

On Monday, January 25, 2021 at 6:36:23 PM UTC-8 Dave S wrote:

> Porting another (personal) application from my old 2.14.6 environment to 
> 2.21.1., and copied both the table files and storage.sqlite from the old 
> application.  Index page works, but another page which displays a sorted 
> list doesn't.
>
> Traceback (most recent call last):
> File 
> "C:\Users\Dave\web2py_win\web2py_win_2.21.1_py27\web2py\gluon\restricted.py", 
> line 219, in restricted
> exec(ccode, environment)
> File 
> "C:\Users\Dave\web2py_win\web2py_win_2.21.1_py27\web2py\applications\QuarterMaster\views\default/sortedQ.html",
>  
> line 77, in 
> File 
> "C:\Users\Dave\web2py_win\web2py_win_2.21.1_py27\web2py\gluon\sqlhtml.py", 
> line 3544, in __init__
> "Column %s not found (SQLTABLE)" % colname)
> KeyError: 'Column QuarterMaster.IssueYr not found (SQLTABLE)' 
>  
>
> A cmd window running sqlite.exe verifies the schema of the table is 
> correct in the db (as expected), and entries made from the index page are 
> showing up.
>
> I delete the table files, set fake_migrate_all = True, and ... lather, 
> rinse .. index works, the table list doesn't, same exception.  And the 
> table files don't get created.
> Add migrate=True to the table definition ... lather, rinse. prior videre.
> Change "fake_migrate_all=True to migrate=False,fake_migrate=True ... 
> lather, rinse, p.v.
>
> Is this a 2.21.1 issue, or have I rejoined those who bungle migrations?
>
>
No suggestions?

/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 web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/b9891cfb-fa86-4942-aaa5-8385be5e0f92n%40googlegroups.com.


Re: [web2py] Title or capitalize names

2021-01-28 Thread Maurice Waka
Cool.
That actually works!
Regards

On Thu, Jan 28, 2021, 17:25 Massimiliano  wrote:

> {{ post.author.first_name.title() }} ... etc..
>  should work
>
> Il giorno gio 28 gen 2021 alle ore 14:05 Maurice Waka <
> mauricew...@gmail.com> ha scritto:
>
>> Hello,
>> How do i use title() or capitalize() on these:
>> {{"%(first_name)s %(last_name)s (%(nickname)s)" % post.author}}
>>
>> I tried e.g.
>>
>> %(first_name.title())s
>> %(first_name).title()s
>>
>> None working
>> Please help
>>
>> --
>> 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 web2py+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/web2py/2d456e41-65b8-46d2-bcba-29f72be606aan%40googlegroups.com
>> 
>> .
>>
>
>
> --
> Massimiliano
>
> --
> 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 web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/CANPTPxLSY-PWNwRku8MOAS009FS4A-YV9vOVNGZ%3DUqJ19oaiGQ%40mail.gmail.com
> 
> .
>

-- 
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 web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CALkNK55zCYrw1gW-pOnWt__GsR5gtQUeAzGbPO63Vb3wd13%2BXw%40mail.gmail.com.


Re: [web2py] Title or capitalize names

2021-01-28 Thread Massimiliano
{{ post.author.first_name.title() }} ... etc..
 should work

Il giorno gio 28 gen 2021 alle ore 14:05 Maurice Waka 
ha scritto:

> Hello,
> How do i use title() or capitalize() on these:
> {{"%(first_name)s %(last_name)s (%(nickname)s)" % post.author}}
>
> I tried e.g.
>
> %(first_name.title())s
> %(first_name).title()s
>
> None working
> Please help
>
> --
> 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 web2py+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/2d456e41-65b8-46d2-bcba-29f72be606aan%40googlegroups.com
> 
> .
>


-- 
Massimiliano

-- 
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 web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/CANPTPxLSY-PWNwRku8MOAS009FS4A-YV9vOVNGZ%3DUqJ19oaiGQ%40mail.gmail.com.


[web2py] Title or capitalize names

2021-01-28 Thread Maurice Waka
Hello,
How do i use title() or capitalize() on these:
{{"%(first_name)s %(last_name)s (%(nickname)s)" % post.author}}

I tried e.g.

%(first_name.title())s
%(first_name).title()s

None working
Please help

-- 
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 web2py+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/web2py/2d456e41-65b8-46d2-bcba-29f72be606aan%40googlegroups.com.