AttributeError: 'DAL' object has no attribute

53 views
Skip to first unread message

Tom Campbell

unread,
Nov 6, 2020, 7:36:06 PM11/6/20
to py4web
I get the message "AttributeError: 'DAL' object has no attribute 'item" and I can't understand why. Here's my whole models.py:

from pydal.validators import *
from py4web.utils.auth import Auth
from .common import db, Field


db
.define_table("invoice",
   
Field("invoice_number","integer"),
   
Field("item_id","reference item"))


db
.define_table("item",
   
Field("description"),
   
Field("sku"))


db
.commit()



Tom Campbell

unread,
Nov 6, 2020, 7:40:07 PM11/6/20
to py4web
P.S. Pydal version 20200714.1

Jim Steil

unread,
Nov 6, 2020, 8:22:18 PM11/6/20
to py4web
Tom

Can you post the full error?

-Jim

Jim Steil

unread,
Nov 6, 2020, 8:24:44 PM11/6/20
to py4web
Also,

What database

Is there any reason you can't upgrade to the latest pydal?

-Jim

Jim Steil

unread,
Nov 6, 2020, 8:36:02 PM11/6/20
to py4web
Wait a second.

Can you put your item table definition before the invoice table definition?

I think it is trying to reference your item table in the invoice table creation, but it doesn't exist yet.

-Jim

Tom Campbell

unread,
Nov 7, 2020, 12:49:30 AM11/7/20
to Jim Steil, py4web
> Can you put your item table definition before the invoice table definition?

Um...

I'm just going to hack into googlegroups.com, delete that earlier message, and replace it with a much better question. Because of course I wouldn't do anything that stupid, Jim. Srsly, of course that was the problem. Thanks!

--
You received this message because you are subscribed to the Google Groups "py4web" group.
To unsubscribe from this group and stop receiving emails from it, send an email to py4web+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/py4web/e3c93ffd-0ca1-4795-bcd4-0bb552b01806o%40googlegroups.com.

Jim Steil

unread,
Nov 7, 2020, 12:52:24 AM11/7/20
to py4web
And delete the part where I didn't see it right away.

Chat with you tomorrow...
To unsubscribe from this group and stop receiving emails from it, send an email to py4web+unsubscribe@googlegroups.com.

Tom Campbell

unread,
Nov 7, 2020, 1:11:35 AM11/7/20
to Jim Steil, py4web
Looking forward to it!

To unsubscribe from this group and stop receiving emails from it, send an email to py4web+un...@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "py4web" group.
To unsubscribe from this group and stop receiving emails from it, send an email to py4web+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/py4web/35126be2-5f46-41ea-b100-4c92fb6fdbe5o%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages