When you go into edit mode, there should be an "Edit subject" link (or
maybe only moderators can see that).
On Monday, March 24, 2014 4:22:35 PM UTC-4, Joe Barnhart wrote:
>
> Huh. Nice descriptive title, huh? Did you know you can't edit the title
> after the post is created? Even if your mouse slipped up and clicked the
> submit button too soon?
>
> Ah well, live and learn.
>
> On Monday, March 24, 2014 1:20:59 PM UTC-7, Joe Barnhart wrote:
>>
>> I'm trying to auto-populate a field when a table entry is created. Of
>> course, web2py has a feature, the "compute=" clause, just for this purpose!
>> But... in my case at least, the feature is not working.
>>
>> OK -- full disclosure of the only weird thing going on in my design... I
>> have pushed all table definitions into module files instead of loading them
>> from the model directory. It saves a lot of time as I have large tables,
>> and a bunch of them. So here is my table:
>>
>> @classmethod
>> def createTable(cls,db):
>> import datetime as dt
>> db.define_table("meet",
>> Field("id_club", "reference club", label="Host club"),
>> Field("id_venue", "reference venue", label="Venue",
>> ondelete="SET NULL"),
>> Field("id_lsc", "reference lsc", label="Swimming
>> association", ondelete="SET NULL"),
>> Field("title", "string", label="Additional Name",comment="ex:
>> Spooktacular Halloween meet"),
>> Field("name", "string",comment="ex: WA Zone 3 C/B/BB+"),
>> Field("sanction", "string", label="Sanction Number"),
>> Field("info", "text",label="Information",comment="To be shown
>> on meet homepage"),
>> Field("start_date", "date", label="Starting
>> date",comment="First day of meet"),
>>
>> ... blah, blah, blah... lots of fields here...
>>
>> Field("season", compute=lambda r: ((r['start_date'] or
>> dt.datetime.now())+dt.timedelta(122)).date),
>> current.auth.signature,
>> format="%(name)s",
>> migrate=current.settings.migrate)
>>
>>
>>
>> The table works perfectly except the compute field of "season" is never
>> populated. I know for a fact the lambda is run, because when I had
>> "datetime" imported into the wrong scope I got a walkback when this line
>> was executed. But for some reason, the result of this calculation is never
>> entered into the database when the row is created.
>>
>> Any ideas??
>>
>> -- Joe B.
>>
>>
--
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/d/optout.