Looking at this post, I defined my commonly-used fields once & then
reuse more simply:
http://groups.google.com/group/web2py/browse_thread/thread/fbd060364ab6227b
timestamp (as per example)
uuidstamp=SQLTable(None,'uuidstamp',
            SQLField('uuid',length=64,
                          writable=False,
                          default=uuid.uuid4()))

Inspired by this post:
http://groups.google.com/group/web2py/browse_thread/thread/c05f65aea2f53c52
I took it further & started defining my reference fields centrally:
location_id=SQLTable(None,'location_id',
         SQLField('location',db.gis_location,requires=IS_NULL_OR
(IS_IN_DB(db,'gis_location.id','gis_location.name'))))

Despite the 1st post saying .comment is now supported, I find it
doesn't work for me with T2...it doesn't error, but doesn't display
either (I just see 'None' in t2.create())
(works fine still if I have it separately in the model)

Would be lovely to be able to add my .display in this definition too:
display=lambda id: (id and [db(db.gis_location.id==id).select()
[0].name] or ["None"])[0]
- currently not supported so tracesback...
I guess this is replaced by .represent, however that tracesback on me
even with the simplified example of represent=lambda value: H2(value)
 SQLField('feature',db.gis_feature,requires=IS_NULL_OR(IS_IN_DB
(db,'gis_feature.id','gis_feature.name')),represent=lambda value: H2
(value)))
  File "C:\Bin\web2py\gluon\sql.py", line 339, in __getattr__
    def __getattr__(self, key): return self[key]
  File "C:\Bin\web2py\gluon\sql.py", line 337, in __getitem__
    def __getitem__(self, key): return dict.__getitem__(self,str(key))
KeyError: 'gis_feature'

Many thanks!
Fran.
--~--~---------~--~----~------------~-------~--~----~
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