I have the following models:

db.define_table('survey',
                Field('name', label = 'Name of the new survey',
                      requires = IS_NOT_IN_DB(db, 'survey.name'),
                      unique = True),
                Field('owner', db.auth_user, default = auth.user_id,
                           readable = True, writable = False),
                Field('startdate', 'date'),
                Field('enddate', 'date'),
                format='%(name)s')

db.define_table('questions',
                Field('survey_id', db.survey),
                Field('question_number', requires = IS_NOT_EMPTY()),
                Field('question', 'text', requires = IS_NOT_EMPTY(),
                  represent = lambda value,row: XML(value),
                  widget = advanced_editor),
                Field('answer_type', 'integer',
                      requires=IS_IN_SET(ANSWER_TYPE)))

db.define_table('options',
                Field('question_id', db.questions),
                Field('option_number'),
                Field('option'))


When using the following grid, I can use the standard View/Edit/Delete 
buttons and it works as expected:

     survey_id = request.get_vars.survey_id
    query = db.questions.survey_id==survey_id
    fields = [db.questions.question_number,
                  db.questions.question,db.questions.answer_type,
                  db.questions.id]
    questions = SQLFORM.grid(query,
                                 editable = True,
                                 deletable = True,
                                 create = True,
                                 searchable = False,
                                 maxtextlength = 100,
                                 orderby=db.questions.question_number
                                 , user_signature = True)

Example of url: 
http://localhost:8000/survey_app/default/edit_survey/edit/questions/2745?survey_id=220&_signature=1e41f2ab5820fe9422d7f1a552f61136cefb26a9


But with this one, using anyone of those buttons ends with a 404 Not found 
message:

    qid = request.args(0,cast=int)
    query = db.options.question_id == qid
    fields = [db.options.id, db.options.option_number, db.options.option]
    form = SQLFORM.grid(query,
                        editable = True,
                        deletable = True,
                        searchable = False,
                        maxtextlength = 100,
                        fields = fields,
                        user_signature = True,
                        create = False)
    
Example of url: 
http://localhost:8000/survey_app/default/edit_options/edit/options/4694?_signature=ec61c90b8595bb73539a0e364f8f4e422f641dd7

Question: Why can the second grid not find the records when I use the 
buttons?
Both the id's in the url's (2745 and 4694) are valid.

Regards
Johann


-- 
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/groups/opt_out.

Reply via email to