i'm understand right now, thank you so much for your detail explaination.

On Sun, May 15, 2011 at 5:02 AM, Anthony <abasta...@gmail.com> wrote:

> On Saturday, May 14, 2011 5:37:39 PM UTC-4, 黄祥 wrote:
>>
>> hi,
>>
>> is there anyone can explain about the usage of default?
>>
>> e.g. on http://web2py.com/book/default/chapter/03#Adding-CRUD
>> db.comment.image_id.default = image.id
>
>
> You can read about it here:
> http://web2py.com/book/default/chapter/06#Record-Representation
>
> It sets the default value for a field for when an insert is done without
> specifying any value, and it is also used to pre-populate SQLFORM fields.
> You can specify it when you define your table, but you can also change it at
> other points in your code (e.g., you may specify a default where the table
> is defined in your model file, but then later change the default in a
> controller function). In the example above, it looks like it's being used to
> pre-populate the crud form with the currently selected image.
>
> Anthony
>

Reply via email to