Mind that T3 is quite dated. Try replace {{=self.read(db.student)}} {{=self.itemize(db.delivery)}} {{=self.create(db.delivery)}}
with {{=self.read(db.student)}} {{=self.itemize(db.delivery)}} {{db.delivery.student_id=self.id}} {{=self.create(db.delivery)}} Let us know if this fixes it. Massimo On Sep 7, 11:42 pm, Júlio Monteiro <jmonte...@gmail.com> wrote: > Hello there, > > On building my first web2py app, I bumped into a problem, perhaps you > can help? > > I have the following DB: > > db.define_table("student", > db.Field("name", length=100, notnull=True), > db.Field("type", requires=IS_IN_SET(("Master","Doctorate"))), > db.Field("entry_date", "date"), > db.Field("deposit_date", "date", notnull=False), > db.Field("defense_date", "date", notnull=False) > ) > > db.define_table("delivery", > db.Field("category", "string"), > db.Field("description"), > db.Field("deliver_date", "date", required=False), > db.Field("devolution_date", "date", required=False), > db.Field("student_id", db.student) > ) > > db.delivery.student_id.requires=IS_IN_DB(db,'student.id','student.name') > ----------------- > > What I want is to have view where I can display student information, > while, at the same time, show deliveries related to him and have a > create form to add new deliveries, with student_id pre-selected to his id > > I am using the T3 wiki, so I tried adding the following to a page: > > {{=self.read(db.student)}} > {{=self.itemize(db.delivery)}} > {{=self.create(db.delivery)}} > > If I pass the student id to request.args[0], the read form works > allright, but the create form does not set its student_id to the id that > came from the request. > > Is there a way to pass this student_id to the form "initial data" to > accomplish that? Or the only way is writing a new widget? > > Thanks, > Julio Monteiro --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---