Hi Massimo,

Sorry to bother you again. I send this mail this morning and seems that 
still is not on the list. I'm reading it using Mark mail and there is 
still nothing from June, may be is a refresh problem, maybe mine is the 
first post of the month, may be is something else, but I can't see my 
mail and any answer (all the previous ones can be reading only if they 
have an answer). This thing about being forced to have a google account 
to be part of open communities is really inconvenient. Is not your fault 
but google's. All other communities I belong that are hosted in google 
need some kind of admin intervention to work smoothly. I miss the old 
days of mailing list (... and use freelist.org for my communities).

Thanks and sorry again. I know that you have more important things to do 
that being my "gateway" to the community.

Cheers,

Offray

Here comes the message:

------------------------------------

Hi all,

My first Web2py app is almost done and with this framework I can even 
take a break and still being productive and nos slaved by development 
:-) (and I'm not a developers so is great to see how web2py brings 
development to common folks). Now I want to create a richer input form 
using rows which information is gathered from two different tables, but 
still I'm not there. I have created a helper SQLObjects for cross 
references between tables. You can see the complete model here:

http://offray.tiddlyspot.com/#Web2pySolucionarioModelo

but the important new parts are this

[1] fuentes_autor=(db.fuentes.autor_id==db.autor.id)
[2] 
fuentes_ediciones=((db.ediciones.fuente_id==db.fuentes.id)&(db.fuentes.autor_id==db.autor.id))
 


[1] gives information about authors and sources and [2] adds information 
about different editions of the same sources (for example two students 
can be solving exercises from two different editions of the same book).

The editions table is related with the sources one. Here is each one:

(sources/fuentes):
db.define_table('fuentes',
   SQLField('autor_id',db.autor),
   SQLField('titulo','string',length=128),
   SQLField('url_web','string'),
   SQLField('tema_id',db.temas))

(editions/ediciones):
db.define_table('ediciones',
   SQLField('fuente_id',db.fuentes),
   SQLField('fecha','string'),
   SQLField('edicion','string'))

This are two conditions for the form to add editions:

     db.ediciones.fecha.requires=IS_NOT_EMPTY()
[3]  
db.ediciones.fuente_id.requires=IS_IN_DB(db,'fuentes.id','fuentes.titulo')

But with the second one I only get the title of the source and I would 
like the Title and the Author, which is in another table. I tried with 
the helper SQLObject [1] replacing [3] with:

db.ediciones.fuente_id.requires=IS_IN_DB(db(fuentes_autor),'db(fuentes_autor).select(db.fuentes.id)','%(db(fuentes_autor).select(db.fuentes.titulo))s
 
%(db(fuentes_autor).select(db.autor.apellido))s')

But I get the error message:

File 
"/home/offray/Programas/Web2py/1.62.3/applications/solucionario/models/db.py" 
<http://127.0.0.1:8000/admin/default/edit/solucionario/models/db.py>, 
line 85, in <module>
   
db.ediciones.fuente_id.requires=IS_IN_DB(db(fuentes_autor),'db(fuentes_autor).select(db.fuentes.id)','%(db(fuentes_autor).select(db.fuentes.titulo))s
 
%(db(fuentes_autor).select(db.autor.apellido))s')
 File "/home/offray/Programas/Web2py/1.62.3/gluon/validators.py", line 
214, in __init__
   (ktable, kfield) = str(self.field).split('.')
ValueError: too many values to unpack


So, I think that I'm almost done trying to use helper SQLObjects to make 
a better input form, but I'm missing something. Any help would be 
appreciated.

Cheers,

Offray

Ps: If I solved this soon, tonight I will try to publish this first app 
to the world (well basically my students, but open to anyone). This will 
be the first of many Web2py apps, some of them pretty more complex. So I 
can not be grateful enough, but you have a new "evangelist" for Spanish 
speakers and Iberoamerica :-P



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to