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

2021-01-29 Thread Muhammad Atif Ayaz
Thank you very much!

On Fri, Jan 29, 2021 at 9:14 AM valq...@gmail.com 
wrote:

> 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
>>>>> <https://groups.google.com/d/msgid/web2py/e19daf19-95c7-4e46-88da-74882bd4e51an%40googlegroups.com?utm_medium=email_source=footer>
>>>>> .
>>>>>
>>>> --
>>>> 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
>>>> <https://groups.google.com/d/msgid/web2py/CAFpY7yFSRZMRPY02sHJtxGasp3T%3Dy7sRdqbq58KncYDdDpkXDg%40mail.gmail.com?utm_medium=email_source=footer>
>>>> .
>>>>
>>> --
>>> 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 

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

2021-01-27 Thread Muhammad Atif Ayaz
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+unsubscr...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/web2py/e19daf19-95c7-4e46-88da-74882bd4e51an%40googlegroups.com
>>> <https://groups.google.com/d/msgid/web2py/e19daf19-95c7-4e46-88da-74882bd4e51an%40googlegroups.com?utm_medium=email_source=footer>
>>> .
>>>
>> --
>> 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+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/web2py/CAFpY7yFSRZMRPY02sHJtxGasp3T%3Dy7sRdqbq58KncYDdDpkXDg%40mail.gmail.com
>> <https://groups.google.com/d/msgid/web2py/CAFpY7yFSRZMRPY02sHJtxGasp3T%3Dy7sRdqbq58KncYDdDpkXDg%40mail.gmail.com?utm_medium=email_source=footer>
>> .
>>
> --
> 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+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/web2py/CAERBpoCjJrCe_3W1Nq%3DZKh8wFc-e8stoHOpMzDwxMHfbFjexKA%40mail.gmail.com
> <https://groups.google.com/d/msgid/web2py/CAERBpoCjJrCe_3W1Nq%3DZKh8wFc-e8stoHOpMzDwxMHfbFjexKA%40mail.gmail.com?utm_medium=email_source=footer>
> .
>

-- 
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/CAFpY7yHS54wiYKsMDof82z%2BD%2BsS%3DAeC%3D1CtyFa5Wx20guw495A%40mail.gmail.com.


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

2021-01-26 Thread Muhammad Atif Ayaz
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+unsubscr...@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 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/CAFpY7yFSRZMRPY02sHJtxGasp3T%3Dy7sRdqbq58KncYDdDpkXDg%40mail.gmail.com.


Re: [web2py] Re: tuple to gluon.dal.Rows conversion

2012-12-19 Thread Muhammad Atif Ayaz
Thanks a lot for a very useful tip

Regards

On Tue, Dec 18, 2012 at 9:18 PM, Anthony abasta...@gmail.com wrote:

 t will automatically convert the res

-- 





Re: [web2py] Re: Unable to create/Insert-in tables in potgre database

2012-12-18 Thread Muhammad Atif Ayaz
yes it's the same application that worked properly with sqlite and now I am
trying to connect it to new postgres db.
sql.log doesn't have a single error message.


On Tue, Dec 18, 2012 at 2:38 PM, Niphlod niph...@gmail.com wrote:

 yeah, but you must be sure that those refer to the new database: if it's
 the same app that worked with sqlite, those statements are for creating
 tables in the sqlite database, not the new postgres one.

 On Tuesday, December 18, 2012 10:04:22 AM UTC+1, at wrote:


 databases/sql.log contains only success messages .. no errors there


 On Tuesday, 18 December 2012 13:36:25 UTC+5, Niphlod wrote:

 see databases/sql.log to see what went wrong.

 On Tuesday, December 18, 2012 7:53:39 AM UTC+1, at wrote:


 Hi,

 Previously I was working on sqlite database with web2py. Now I've
 installed postgresql-9.1.7-1-windows-**x64, created a user role
 (testuser) and database (testdb) and tested connectivity using psql; all
 went fine.

 Then I've define following statement in db.py:
 *db = DAL('postgres://testuser:12345@localhost/testdb')*

 Previously it was:
 #db = DAL('sqlite://storage.sqlite')

 Web2py and application started successfully, but it doesn't create
 tables defined in db.py; consider the following def:
 *db.define_table('taxpayer',
 Field('name'),
 Field('married', 'boolean'),
 Field('spouse_name'))
 *
 When I try to insert records in this table, I get following error
 message:
 class 'gluon.contrib.pg8000.errors.**ProgrammingError' ('ERROR',
 '42P01', 'relation taxpayer does not exist')

 Can somebody help please ?

 Thanks  Regards
 AT



  --





--