Error: 405 Method Not Allowed - in form

72 views
Skip to first unread message

Alex Glaros

unread,
Jul 14, 2022, 9:39:30 PM7/14/22
to py4web

There's no message in "Recent Tickets". Where to find what is wrong?

Error: 405 Method Not Allowed

Sorry, the requested URL 'http://localhost:8000/engagementsquared/manage_relationship_types' caused an error:

Method not allowed.Exception:-] Forbidden [-Traceback:-] Forbidden [-


form_add_relationship_type = Form(db.relationship_type, formstyle=FormStyleDefault)    

if form_add_relationship_type.accepted:

        redirect(URL('manage_relationship_type'))


MODEL:

db.define_table('relationship_type',
Field('id','id', label='relationship Type ID', readable = False, writable = False),
Field('relationship_type_name','string', requires = IS_NOT_EMPTY()),
Field('organization_fk','integer', readable = True, writable = False, default = 1),
Field('transparency_level_fk', 'string', comment = 'Choose transparency level (you can change at any time)', writable = True, readable = True),
Field('owner_object_fk', 'integer'),
Field('relationship_type_comments','text', label = 'Relation Type Comments', requires = IS_NOT_EMPTY()),
Field('object_type_fk', 'integer'),
Field('track_this_relationship_type', 'boolean', default = True, comment = 'Enabled, means will keep track of all relationships'),
Field('created_by_function', 'string', default = request.url),
auth.signature,
format = '%(relationship_type_name)s', fake_migrate = False, migrate = True)  


Jim Steil

unread,
Jul 14, 2022, 11:33:55 PM7/14/22
to py4web
What does the entire controller method including the @action and @action.uses decorator?

Have you tried debugging and setting some breakpoints to see what statement is causing this error?

-Jim
Message has been deleted
Message has been deleted

Alex Glaros

unread,
Jul 15, 2022, 12:17:08 AM7/15/22
to py4web
@action("manage_relationship_types")
@action.uses("manage_relationship_types.html", auth, T, session, db,)
@action('manage_relationship_types/<path:path>', method=['POST', 'GET'])
def manage_relationship_types():
    query = db.relationship_type.id>0
    grid = Grid(path=None, query = (db.relationship_type.id>0))
    db.relationship_type.created_on.readable = db.relationship_type.created_on.writable = False
    db.relationship_type.created_by.readable = db.relationship_type.created_by.writable = False
    db.relationship_type.modified_on.readable = db.relationship_type.modified_on.writable = False
    db.relationship_type.modified_by.readable = db.relationship_type.modified_by.writable = False
    db.relationship_type.created_by_function.default = request.url

    form_add_relationship_type = Form(db.relationship_type, formstyle=FormStyleDefault)
    if form_add_relationship_type.accepted:
        redirect(URL('manage_relationship_types'))
    return locals()

Jim Steil

unread,
Jul 15, 2022, 10:08:22 AM7/15/22
to py4web
Can you try adding:

method=['POST', 'GET']

to the first @action?

-Jim

Reply all
Reply to author
Forward
0 new messages