you have
hist_id = db.sales_cycle_history.insert(sales_cycle_id=scid, ...)
so you should do
row = db(db.sales_cycles.id == hist_id).select().first()
or
row = db(db.sales_cycles.sales_cycle_id == scid).select().first()
but NOT
row = db(db.sales_cycles.id == scid).select().first()
On Friday, 26 February 2016 09:03:30 UTC-6, Louis Beetge wrote:
>
> HI everybody
>
> I have a REALLY weird problem. Take a look at this code:
>
> def save_disposition():
> dispo_id = request.vars.disposition_id
> dispo_name = request.vars.disposition_name
> scid = request.vars.sales_cycle_id
> linked_scid = request.vars.linked_contact_sc_id
>
>
> questions = db(db.disposition_questions.disposition_id == dispo_id).
> select()
>
>
> hist_id = db.sales_cycle_history.insert(sales_cycle_id=scid,
> disposition_id=dispo_id, action_performed=dispo_name)
>
>
> row = db(db.sales_cycles.id == scid).select().first()
> pid = row.product_id
>
> I get the following error:
> <type 'exceptions.AttributeError'> 'NoneType' object has no attribute
> 'product_id' for this line: pid = row.product_id
>
> Before everybody starts yelling that it's returning an empty object, lemme
> explain. When I comment out "pid = row.product_id" and return
> response.json(row), it returns the fetched row without any issue ie:
>
> {"application_id": 8, "product_id": 13, "modified_by": 138, "is_active":
> true, "created_by": 138, "linked_contact_sc_id": null, "request_tenant":
> "2", "created_on": "2016-02-24 19:00:59", "contact_id": 9823,
> "modified_on": "2016-02-24 19:00:59", "disposition_id": null, "id": 9853}
>
> This is extremely frustrating and I cant seem to find anyone else who has
> had the same issue.
>
> ANY ideas or pointing in the right direction would be greatly appreciated
>
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.