No object has no attribute 'edit_form'

10 views
Skip to first unread message

Himalayan

unread,
Dec 7, 2011, 2:36:20 AM12/7/11
to turbo...@googlegroups.com
Hi

I am developing my first Turbo Gears 2 application. I have been following all the tutorials etc. available. However, when creating a form to add a new user I am getting the following error.

AttributeError: 'UserController' object has no attribute 'edit_form'

The relevant code is

from sprox.tablebase import TableBase
class UserTable(TableBase):
    __model__ = MCUser
user_table = UserTable(DBSession)

from sprox.fillerbase import TableFiller
class UserTableFiller(TableFiller):
    __model__ = MCUser
user_table_filler = UserTableFiller(DBSession)

"""
MCUsers
"""

class UserController(CrudRestController):
    model = MCUser
    allow_only = in_group('standard')

    @expose('mc27.templates.register_user')
    def index(self):
        logging.info("AA: Entering user / default")
        return "empty"

    def adduser(AddRecordForm):
        logging.info('AA: entering add user')
        user_filler = user_table_filler

Any help would be appreciated. If I need to post more details, please let me know.

Thanks

Alessandro Molina

unread,
Dec 7, 2011, 3:42:25 AM12/7/11
to turbo...@googlegroups.com
You probably have to add an edit_form attribute to the UserController
to let the crudrestcontroller know which form it has to use to permit
editing the user.

Take a look at http://www.turbogears.org/2.1/docs/main/Extensions/Crud/index.html#forms
for documentation about forms in CrudRestController.

> --
> You received this message because you are subscribed to the Google Groups
> "TurboGears" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/turbogears/-/CFFEXEOYZAMJ.
> To post to this group, send email to turbo...@googlegroups.com.
> To unsubscribe from this group, send email to
> turbogears+...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/turbogears?hl=en.

Reply all
Reply to author
Forward
0 new messages