Hey everyone,
I saw a random bug in an app I'm working on, and I was wondering what the
correct approach is.
I have auth.settings.extra_fields["auth_user"] = [LIST_OF_FIELDS]
later, I select that row and get it as a dict:
row = db(db.auth_user.id == user_id).select().first().as_dict()
then I
Hello Mark,
Not sure about the bool part, I think web2py treat bool like that to comply
with all the different backend and the apdater does the rest...
On the other hand I am curious that you update row with simple update(),
you suppose to use update_record()
Ref:
http://www.web2py.com/books/def
>
> On the other hand I am curious that you update row with simple update(),
> you suppose to use update_record()
>
They are both valid methods -- .update updates the Row object itself (like
updating a dictionary), whereas .update_record updates the record in the
database. You can actually iss
On Wednesday, April 6, 2016 at 11:20:44 AM UTC-4, Anthony wrote:
>
> On the other hand I am curious that you update row with simple update(),
>> you suppose to use update_record()
>>
>
> They are both valid methods -- .update updates the Row object itself (like
> updating a dictionary), whereas .
You maybe right Anthony abour update_record() it really depend though of
what he is trying todo...
:)
Richard
On Wed, Apr 6, 2016 at 11:21 AM, Anthony wrote:
> On Wednesday, April 6, 2016 at 11:20:44 AM UTC-4, Anthony wrote:
>>
>> On the other hand I am curious that you update row with simple
On Wednesday, April 6, 2016 at 11:30:34 AM UTC-4, Richard wrote:
>
> You maybe right Anthony abour update_record() it really depend though of
> what he is trying todo...
>
Well at the point where row.update() is called, row is already a
dictionary, so there is no .update_record() at that point.
Yeah you right...
On Wed, Apr 6, 2016 at 12:06 PM, Anthony wrote:
> On Wednesday, April 6, 2016 at 11:30:34 AM UTC-4, Richard wrote:
>>
>> You maybe right Anthony abour update_record() it really depend though of
>> what he is trying todo...
>>
>
> Well at the point where row.update() is called,
Hey Anthony and Richard,
Yes you are both correct.
I am attempting to create a usable JSON object.
The confounding details from what I can tell are:
1.) the offending method is defined in a model file, which returns a
dictionary, which is then json serialized via
response.json(RETURNED_FROM_MO
Offending code from a fresh web2py welcome app:
in db.py
before auth.define_tables()
from gluon.contrib.populate import populate
auth.settings.extra_fields['auth_user'] = [Field('test_field_1','boolean')]
in controller default.py
def test():
if db(db.auth_user.id>0).isempty():
po
>
> table = db.auth_user
> fields = ['id','first_name']
> fields.append('test_field_1')
>
> query = table.id > 0
>
> row = db(query).select(*fields).first().as_dict()
>
The problem is that you aren't passing the correct arguments to .select().
You must pass Field ob
Ah!
Of course.
Thanks Anthony!
I knew it was something dumb i did =)
-Mark
On Wed, Apr 6, 2016 at 11:35 AM, Anthony wrote:
> table = db.auth_user
>> fields = ['id','first_name']
>> fields.append('test_field_1')
>>
>> query = table.id > 0
>>
>> row = db(query).select(*fiel
Good catch Anthony!
On Wednesday, 6 April 2016 13:35:39 UTC-5, Anthony wrote:
>
> table = db.auth_user
>> fields = ['id','first_name']
>> fields.append('test_field_1')
>>
>> query = table.id > 0
>>
>> row = db(query).select(*fields).first().as_dict()
>>
>
> The proble
12 matches
Mail list logo