This is complex in the general case. I will think about this.

Meanwhile I suggest you make another file t2_far.py which defines

class T2Fran(T2): pass

which extends T2 and you add the methods you need. Use T2Fran instead
of T2. If you want to share your method, I will be happy to look at it
and perhaps incorporate it in the "official" one.

Massimo


On Dec 8, 5:01 pm, Fran <[EMAIL PROTECTED]> wrote:
> I have a whole bunch of tables:
> gis_layer
> gis_layer_openstreetmap
> gis_layer_google
> etc
>
> They are linked together (e.g.
> gis_layer_openstreetmap.layer==gis_layer.id)
>
> This way all common fields are held in the top-level table.
> All fields that only apply to the relevant gis_layer.type are held in
> it's own table.
> (I understand this to be the correct db design, but am happy to hear
> alternate suggestions).
>
> I want to use T2's simple CRUD mechanism to view all the details for a
> layer on one screen (via t2.display), edit all fields on another
> screen (via t2.update) & delete from all tables via t2.delete.
> This doesn't appear to be possible currently (the 'query=' option only
> acts as a filter).
>
> I can get something close for 'display' by simply displaying the 2
> itmeize's 1 after the other (although ugly since row lengths are
> different) using a controller like this:
> main=t2.display(db.gis_layer)
> type=db(db.gis_layer.id==t2.id).select()[0].type
> if type=='google':
>         type_display=t2.display
> (db.gis_layer_google,query='gis_layer_google.layer==id')
> elif type=='openstreetmap':
>         type_display=t2.display
> (db.gis_layer_openstreetmap,query='gis_layer_openstreetmap.layer==id')
>
> For 'update', this doesn't work as I get 2 forms with separate submit
> buttons.
>
> Whilst having a generic solution would be lovely (this is a feature
> request as I think many people must have linked tables), I think it'll
> be more within my skill level for me to create additional classes in
> t2.py like 'update_layer', etc which are hardcoded to my setup. I'd
> rather not throw T2 out completely so I can still use the conflict
> detection, etc
>
> Any suggestions on good solutions would be welcomed :)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to